0
How to that in c code
Write a program that reads numbers from the user until the number 0 is e tered, and then prints them in reverse order. Do not use arrays in your solution. I try this, but it is not working. https://code.sololearn.com/cBr6wOEQRuKJ/?ref=app
2 odpowiedzi
+ 18
Your code works fine as per your desired output.
Try this input:
1234560789
The output will be:
654321
0
Don't use getchar(), what if you are trying to input 2 or more digits numbers? Here's my version,
#include <stdio.h>
int main (void)
{
int v;
scanf ("%d", &v);
if (v)
{
main ();
printf ("%d\n", v);
}
return 0;
}