Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- bool palindrome(long x);
- int main()
- {
- int t,i;
- long p;
- cin>>t;
- for(i=1; i<=t; i++)
- {
- cin>>p;
- if(palindrome(p)==true)
- cout<<"Case "<<i<<": Yes"<<endl;
- else
- cout<<"Case "<<i<<": No"<<endl;
- }
- return 0;
- }
- bool palindrome(long x)
- {
- long rev,n;
- n=x;
- while(n>0)
- {
- rev=rev*10+n%10;
- n=n/10;
- }
- if(x==rev)
- return true;
- else
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement