Advertisement
Josif_tepe

Untitled

Dec 21st, 2024
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int n;
  6.     scanf("%d", &n);
  7.    
  8.     int prevrten_broj = 0;
  9.    
  10.     int tmp = n;
  11.     while(tmp > 0) {
  12.         int cifra = tmp % 10;
  13.         tmp /= 10;
  14.        
  15.         prevrten_broj = (prevrten_broj * 10) + cifra;
  16.     }
  17.    
  18.     if(n == prevrten_broj) {
  19.         printf("PALINDROM\n");
  20.     }
  21.     else {
  22.         printf("NE E PALINDROM\n");
  23.     }
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement