Share Post:
By Siddique Hassan.
#include <stdio.h>
#include<conio.h>
int main()
{
int n, reverse = 0;
printf("Enter a number to reverse\n");
scanf("%d",&n);
while (n != 0)
{
reverse = reverse * 10;
reverse = reverse + n%10;
n = n/10;
}
printf("Reverse of entered number is = %d\n", reverse);
return 0;
}
This program reverses the number given as input by the user. Eg. if user enters 123 the output will be 321.Thursday, March 13, 2014
RELATED POSTS
Get Your IP By C Program!
This program will read your IP from system and then prints it on the scree ...
C program to check leap year
C program to find whether the year entered by user is a leap year or not. ...
Basic C program to print sum of squares of 4 numbers
#include <stdio.h> #include <stdlib.h> int main() { &n ...
C program to print Floyd's triangle.
This program prints Floyd's triangle. Number of rows of Floyd's triangle t ...
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment