If a Five-Digit number is input through the Keyboard, Write a program to reverse the number. - Code With Friends

Breaking

Home Top Ad

Search Your Questions

Friday, February 22, 2019

If a Five-Digit number is input through the Keyboard, Write a program to reverse the number.

#include<stdio.h>
int 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);
}




No comments:

Post a Comment