write a program in C to check whether a given number is palindrome or not
Answers
Answered by
9
#include<stdio.h>
#include<conio.h>
int main ()
{
clrscr();
int n, num, digit, rev = 0 ;
printf(Input the number:);
scanf("%d"num) ;
n = num ;
do
{
digit = num % 10 ;
rev = ( rev * 10 ) + digit ;
num = num / 10 ;
}
while ( num != 0);
if( n == rev )
{
printf(The number is palindrome );
}
else
{
printf( The number is not palindrome );
}
return 0 ;
}
#include<conio.h>
int main ()
{
clrscr();
int n, num, digit, rev = 0 ;
printf(Input the number:);
scanf("%d"num) ;
n = num ;
do
{
digit = num % 10 ;
rev = ( rev * 10 ) + digit ;
num = num / 10 ;
}
while ( num != 0);
if( n == rev )
{
printf(The number is palindrome );
}
else
{
printf( The number is not palindrome );
}
return 0 ;
}
Similar questions