C examples for Data Type:int
If a given integer is 12345, then its reverse is 54321.
#include <stdio.h> int main()// w ww. ja v a 2 s . c om { long int counter = 1234, temp, remainder, reverse; temp = counter; reverse = 0; while (temp > 0){ remainder = temp % 10; reverse = reverse * 10 + remainder; temp /= 10; } printf("The reverse of %ld is %ld.\n", counter, reverse); return 0; }