Aim – WAP To Reverse a 5-digit Number and Check Whether The Reversed And Original Numbers Are Equal
Code -
#include<stdio.h>
#include<conio.h>
void main ()
{
long int num, a, b, c, d, e, num1;
clrscr ();
printf ("Enter The 5 Digit Number : ");
scanf ("%ld", &num);
e=num;
a=num%10;
num=num/10;
b=num%10;
num=num/10;
c=num%10;
num=num/10;
d=num%10;
num=num/10;
num1=a*10000+b*1000+c*100+d*10+num;
printf ("The Reversed Number Is : %ld \n", num1);
if (e==num1)
printf ("The Entered and Reversed Numbers Are Equal\n");
else
printf ("The Entered and Reversed Numbers Are Not equal\n");
getch ();
}
OUTPUT
Enter The 5 Digit Number : 54345
The Reversed Number Is : 54345
The Entered and Reversed Number Are Equal
No comments:
Post a Comment