|There are much better solutions to the problem at hand.|
I suggest using a "while" loop, then it's possible to use the same code for any number a int can hold.
I understand that you are doing a correspondence course(from prior posts) so I am reluctant to post full code. Instead I will post a "psuedo" code of sorts.
// This is a made up language to show logic
// It can't be used as is
input = 0;
reverse = 0;
counter = 1; //can be zero based if you like
showtext("Enter a number\n");
while(input isn't 0)
showtext("position =var1=, value =var2=\n", counter, input % 10);
reverse += num % 10;
input /= 10;
if (input isn't 0)
showtext("Reversed number =var1=, No. digits: =var2=\n" reverse, counter);
To be perfectly honest I just made it too easy for you.
I know your new here but it is customary to close topics with something to let people it' finished. All it need be is:
"Thanks, it worked"
"I found another solution"
"I don't need it anyomre"
(This is going by a couple of you previous posts)