Advertisement
Kl43z

Capicúa / Tarea

Sep 4th, 2014
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(){
  4. int num,cif1,cif2;
  5. printf("Ingrese el número que desea verificar (debe contener 3 cifras):\n");
  6. scanf("%d",&num);
  7. if (num>=100 && num<=999){
  8. cif1=num/100;
  9. if (num%100>9){
  10. cif2=(num%100)%10;
  11.  
  12. }
  13. else {
  14. cif2=num%100;
  15. }
  16. if (cif1==cif2){
  17. printf("El número %d es CAPICÚA.\n",num);
  18. }
  19. else {
  20. printf("El número ingresado no es capicúa.\n");
  21. }
  22. }
  23. else{
  24. printf("El número ingresado no posee 3 cifras...\n");
  25. }
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement