0
3.4kviews
Write a C program to check if the given number is a palindrome or not.

Mumbai University> FE > Sem 2> STRUCTURED PROGRAMMING APPROACH

Marks: 6 M

Year: Dec 2016

1 Answer
0
349views
#include<stdio.h>
#include<conio.h>
main()
{
int n,reverse=0,digit;
printf(“Enter a number:”);
scanf(“%d”,&n);
while(n!=0)
{
    digit=n%10;
    reverse=reverse*10+digit;
    n=n/10;
}
if(n==reverse)
{
printf(“Number is palindrome”);
}
else
{
    printf(“Number is not palindrome”);
}
getch();
}

Output:
Enter a number: 32923
Number is palindrome
Please log in to add an answer.