#include <stdio.h> int main(void) { int number = 123; int rightMostNumber = 0; int temp = 0; temp = number; do { rightMostNumber = 10*rightMostNumber + temp % 10; temp = temp/10; } while (temp); printf ("\nThe number %d reversed is %d\n", number, rightMostNumber ); return 0; }
The number 123 reversed is 321