Created
December 19, 2014 09:40
-
-
Save scratchyourbrain/73974ac92ce04860cba7 to your computer and use it in GitHub Desktop.
C Program to Reverse a Number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int main() | |
| { | |
| int n, reverse=0, rem; | |
| printf("Enter an integer: "); | |
| scanf("%d", &n); | |
| while(n!=0) | |
| { | |
| rem=n%10; | |
| reverse=reverse*10+rem; | |
| n/=10; | |
| } | |
| printf("Reversed Number = %d",reverse); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment