G
gk245
I have something like this:
printf("Enter numbers: ");
scanf ("%i", &number);
If the user put in a bunch of numbers (like 4568), instead of just one
number, i know that you can extract the right most digit with this:
right_number = number % 10;
/* print the number */
number = number / 10;
Well, i have the above setup in a loop, so i keep getting the right
most digit printed out. However, they're all backwards since i am
reading in the right-most digit first. How do i make it so it reads
the left-most first, and then proceeds to print? Or is there a way to
flip the right most ones around afterwards?
I can only use printf, scanf and switch functions right now.
Thx.
printf("Enter numbers: ");
scanf ("%i", &number);
If the user put in a bunch of numbers (like 4568), instead of just one
number, i know that you can extract the right most digit with this:
right_number = number % 10;
/* print the number */
number = number / 10;
Well, i have the above setup in a loop, so i keep getting the right
most digit printed out. However, they're all backwards since i am
reading in the right-most digit first. How do i make it so it reads
the left-most first, and then proceeds to print? Or is there a way to
flip the right most ones around afterwards?
I can only use printf, scanf and switch functions right now.
Thx.