Hi everybody;
i need a program that writes reverse of a number for ex;
if i enter 42 output will be 24 and, for 789 it will be 987.
We don't know how many digits will user type...
Thanks... Have a nice day...
Hi everybody;
i need a program that writes reverse of a number for ex;
if i enter 42 output will be 24 and, for 789 it will be 987.
We don't know how many digits will user type...
Thanks... Have a nice day...
Hint. 24 / 10 = 2 remainder 4.
http://en.wikipedia.org/wiki/Modulo_operation
Or you could read as a string and print out the string in reverse - also allows you
to easily validate the input - use fgets to read a string if you don't know how to
already. Tonto's solution is the most common answer to this question, so
whichever suits you.
No No's:
fflush (stdin); gets (); void main ();
Goodies:
Example of fgets (); The FAQ, C/C++ Reference
My Gear:
OS - Windows XP
IDE - MS Visual C++ 2008 Express Edition
ASCII stupid question, get a stupid ANSI
Tonto and Richie T. thanks for your attention. I hope i will write true code after your help...
Thanks