Apr 15, 2009 at 12:36pm UTC
can some 1 help me check where is the error...the logic shld b correct
#include <iostream>
#include <cstdlib>
using namespace std;
bool palindromes(long no);
int main ()
{
long num,no;
cout<<"Input a number to check if it is palindrome -> ";
cin>>num;
palindromes(long no);
if (no = true)
{
cout<<num;
cout<<" is a palindrome.";
}
else
{
cout<<num;
cout<<" is not a palindrome.";
}
cout<<endl;
system("pause");
return 0;
}
bool palindromes(long no)
{
long num, quation, remainder,RN;
quation=num;
RN=0;
do
{
remainder=quation%10;
quation=quation/10;
RN=RN*10+remainder;
}
while (quation!=0);
if (num==RN)
{
return true;
}
else
{
return false;
}
}
Apr 15, 2009 at 12:55pm UTC
i change le still gt error
Apr 15, 2009 at 1:08pm UTC
its a function qn and i nid to return true and false to the palindromes(long num)
Apr 17, 2009 at 3:15am UTC
What kind of error(s) do you have? What does your compiler say when you try to build? also you should post your updated code, and put it in between code tags.