Write a function to check whether a number is palindrome or not.
#include <stdio.h>
#include <conio.h>
int reverse ( int );
void main ( )
{
int r, n;
clrscr ( );
printf("\n\n\n\n\t\t Enter a number..:"); scanf("%d",&n);
r = reverse ( n );
if ( r == n )
{
printf("\n\n\n\t\t The number is a palindrome number.");
}
else
{
printf("\n\n\n\t\t The number is not a palindrome number.");
}
getch ( );
}
int reverse ( int n )
{
int s = 0, d;
while ( n > 0 )
{
d = n % 10;
n = n / 10;
s = s * 10 + d;
}
return s;
}
Click here to contact us
#include <stdio.h>
#include <conio.h>
int reverse ( int );
void main ( )
{
int r, n;
clrscr ( );
printf("\n\n\n\n\t\t Enter a number..:"); scanf("%d",&n);
r = reverse ( n );
if ( r == n )
{
printf("\n\n\n\t\t The number is a palindrome number.");
}
else
{
printf("\n\n\n\t\t The number is not a palindrome number.");
}
getch ( );
}
int reverse ( int n )
{
int s = 0, d;
while ( n > 0 )
{
d = n % 10;
n = n / 10;
s = s * 10 + d;
}
return s;
}
Click here to contact us
No comments:
Post a Comment