APC-S-005.c (641B)
1 /* Write to reverse a number. */ 2 3 /* 4 * Compiler Note: This source code is specifically designed for compilation 5 * and execution within the ** Turbo C ** environment. 6 * 7 * Testing Disclaimer: Due to a lack of access to the required Turbo C 8 * compiler software, this code has not been formally compiled or tested. 9 */ 10 11 #include <stdio.h> 12 #include <conio.h> 13 14 void main() 15 { 16 clrscr(); 17 int n, reverse = 0, rem; 18 printf("Enter the numner : "); 19 scanf("%d", &n); 20 while (n != 0) 21 { 22 rem = n % 10; 23 reverse = reverse * 10 + rem; 24 n /= 10; 25 } 26 printf("Reversed Number : %d", reverse); 27 getch(); 28 }