Advertisement
sellmmaahh

zad3-samostalni2

Mar 6th, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cmath>
  4.  
  5. int funk(int n)
  6. { bool t(true);
  7.     int a(n), cifra(0), nb(1);
  8.     while (a!=0)
  9.     {
  10.         cifra=a%10;
  11.         nb=nb*10+cifra;
  12.         a/=10;
  13.     }
  14.     if (nb!=a) return t;
  15.  
  16. }
  17.  
  18. int main ()
  19. {
  20.     int n;
  21.     std::cout<<"Unesite neki broj: ";
  22.     while (std::cin>>n, n!=0)
  23. {
  24.     if (funk(n)==true) std::cout<<"Uneseni broj je simetrican."<<std::endl;
  25.     else std::cout<<"Broj nije simetrican."<<std::endl;
  26.     return 0;
  27. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement