If a five digit number is input through the keyboard write a prog to reverse the numbe
Answers
Answer:
Step-by-step explanation:
Our aim is to write a program where the output is the reverse of the input number with five digits.
Since, we want the user to tell us five digits, we will receive a number with five digits, in order to give the reverse of the input, we have the following:
main()
{
long num,a,b,c,d,e,rev;
printf("Enter a five digit number\n");
scanf("%ld",&num);
a=num%10; b=num/10;
c=b%10; b=b/10;
d=b%10; b=b/10;
e=b%10; b=b/10;
rev=a*10000+c*1000+d*100+e*10+b*1;
printf("Reverse of %ld is %ld",num,rev);
}
Hence, done.
I hope this helps you. Keep it up!
Programme
#include <studio.h>
int main()
{
int number=0,n;
printf("Enter the number");
scanf("%d",&n");
while(n!=0)
{
number=number*10;
number=n%10+number;
n=n/10;
}
printf("%d",number)
return 0;
}