EmbLogic's Blog

Write a program to reverse a number?

CODE:

#include<stdio.h>
int main()
{
int n,r=0,num;
printf(“Enter a number:\n”);
scanf(“%d”,&n);
num=n;
while(n!=0)
{
r=r*10;
r=r+n%10;
n=n/10;
}
printf(“Reverse number is %d\n”,r);
if(num==r)
printf(“Palindrome number\n”);
else
printf(“Not a Palindrome\n”);
return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>