Advertisement
avukas

palindrom

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