Answer :
#include<stdio.h> //header file contains the function,decleraction and macro defination of key words used in code.
int main ()
{
int num,num1,num2,reverse; //adressing the variables
printf("Enter the number you want to reverse : "); //output
scanf("%d",&num);
num2=num;
while (num!=0)
{
num1=num%10; // it will store the last number
reverse=reverse*10+num1; //it will add it
num=num/10; // it will remove the last digit
}
printf("%d is the palindrome of %d",reverse,num2); //output
}
Output :
0 Comments