Created
June 8, 2015 03:07
-
-
Save 0x000000AC/2995dd78ae628af13495 to your computer and use it in GitHub Desktop.
Reversing an Int in a While() loop
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(void) | |
{ | |
int number, right_digit; | |
printf ("Enter your number.\n"); | |
scanf ("%i", &number); | |
while ( number != 0 ) | |
{ | |
right_digit = number % 10; | |
printf ("%i", right_digit); | |
number = number / 10; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment