Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- bool palindrom(int n)
- {
- int c, im = 0;
- int copien = n;
- do
- {
- c = copien%10;
- im = im * 10 + c;
- copien = copien / 10;
- }
- while(copien != 0);
- if(im == n)
- return 1;
- else
- return 0;
- }
- int main()
- {
- cout << palindrom(123) << endl;
- cout << palindrom(121) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment