naskedvi

S1 - zad.21.

Mar 2nd, 2014
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. int a, broj(0), cifra;
  6. std:: cin >> a;
  7. int b(a);
  8. while(a!=0)
  9. {
  10. cifra=a%10;
  11. a/=10;
  12. broj=broj*10+cifra;
  13.  
  14. }
  15. std:: cout << broj<< std::endl;
  16.  
  17.  
  18. if(broj==b)
  19. std:: cout << "Broj je palindrom!";
  20.  
  21. else std::cout<<"Broj nije palindrom!";
  22.  
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment