Program for reverse the number entered by a user :
Code goes like this :
/* Program for reversing any number */
#include<stdio.h>
main()
{
int rev=0,rem,num;
printf("Enter any number :");
scanf("%d",&num);
while(num!=0)
{
rem=num%10;
rev=rev*10+rem;
num=num/10;
}
printf("\n The reverse no is: %d",rev);
}
Output :
Compiler Used : Dev CPP
- Blogger Comment
- Facebook Comment
Subscribe to:
Post Comments
(
Atom
)
0 comments:
Post a Comment