hi all....I need help with a pragram which i wrote .....Itz to check if a number is palindrome or not using a function...i.e. the program will ask the user to input any number....then if u reverse the number it will give u the same old number then it is a palindrome number....For Example: if the user enters 121 ...then if u reverse it will give u the same number 121..and so 121 is a palindrome number.....The program which i wrote is below:
#include<iostream.h>
int palindrome(int n)
{
int x, m=0;
while(n>0)
{
x=n%10;
m*=10;
m+=x;
n/=10;
}
return m;
}
void main()
int n, y;
cout<<"Enter any number"<<endl;
cin>>n;
y=palindrome(n);
if(n==y)
cout<<"The entered number is a palindrome number "<<endl;
else
cout<<"The entered number is not a palindrome number "<<endl;
}
The errors of the program are:
:warning C4518: 'int ' : storage-class or type specifier(s) unexpected here; ignored
: error C2146: syntax error : missing ';' before identifier 'n'
: fatal error C1004: unexpected end of file found