Can anyone please help me with this...
I am USING DEV C++
theirs always an error when i try to RUN it...
it's about Palindrome Numbers...
the instruction was when the user gives a number the computer should tell whether it is Palindrome or NOt...
here's my problem...
#include%26lt;stdio.h%26gt;
#include%26lt;conio.h%26gt;
int palindrome(int n)
{
int x, m=0;
while(n%26gt;0)
{
x=n%10;
m*=10;
m+=x;
n/=10;
}
return m;
}
void main()
int n, y;
count%26lt;%26lt;"Enter any number"%26lt;%26lt;endl;
cin%26gt;%26gt;n;
y=palindrome(n);
if(n==y)
cout%26lt;%26lt;"The entered number is a palindrome number "%26lt;%26lt;endl;
else
cout%26lt;%26lt;"The entered number is not a palindrome number "%26lt;%26lt;endl;
}
tnx!!!
Palindrome NUmbers at dev c++...? (help)?
This should not compile. Here are the 2 corrections you need:
#include %26lt;iostream%26gt;
using namespace std;
int palindrome(int n)
{
int x, m=0;
while(n%26gt;0)
{
x=n%10;
m*=10;
m+=x;
n/=10;
}
return m;
}
void main()
{
int n, y;
cout%26lt;%26lt;"Enter any number"%26lt;%26lt;endl;
cin%26gt;%26gt;n;
y=palindrome(n);
if(n==y)
cout%26lt;%26lt;"The entered number is a palindrome number "%26lt;%26lt;endl;
else
cout%26lt;%26lt;"The entered number is not a palindrome number "%26lt;%26lt;endl;
}
Corrections:
Changed
count%26lt;%26lt;"Enter any number"%26lt;%26lt;endl;
to
cout%26lt;%26lt;"Enter any number"%26lt;%26lt;endl;
Add missing bracket after void main()
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment