Advertisement
a53

Plimbare

a53
Jan 25th, 2017
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <fstream>
  2. using namespace std;
  3. ifstream f("plimbare.in");
  4. ofstream g("plimbare.out");
  5. int n,x;
  6.  
  7. bool palindrom(int x)
  8. {
  9. int z=0,y;
  10. y=x;
  11. while(x!=0)
  12. {
  13. z=z*10+x%10;
  14. x=x/10;
  15. }
  16. if(z==y)
  17. return true;
  18. else
  19. return false;
  20. }
  21.  
  22. int main()
  23. {
  24. f>>n;
  25. int nr=0;
  26. while(n--)
  27. {
  28. f>>x;
  29. if(palindrom(x))
  30. ++nr;
  31. }
  32. g<<nr;
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement