Saturday, 14 July 2012
How to Reverse a given number using C program
#include<stdio.h>
int main()
{
int num,r,reverse=0;
printf("Enter Any numb: ");
scanf("%d",&num);
while(num)
{
r=num%10;
reverse=reverse*10+r;
num=num/10;
}
printf("Reversed of number: %d",reverse);
return 0;
}
Example output:
Enter Any numb: 143
Reversed of number: 341
This post was written by: Bharathi
Bharthi is a professional blogger, web designer and front end web developer. Follow him on Twitter
Subscribe to:
Post Comments (Atom)
0 Responses to “How to Reverse a given number using C program”
Post a Comment