pc010.c (548B)
1 /* 2 * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 12 Dec 2025 3 * Repo: https://github.com/notamitgamer/bsc 4 * License: MIT 5 */ 6 7 /* Reverse a number */ 8 9 #include <stdio.h> 10 int main() 11 { 12 int num, temp, rev = 0; 13 printf("\nEnter the number : "); 14 if (scanf("%d", &num) != 1) 15 { 16 printf("\nOnly a number is allowed."); 17 return 1; 18 } 19 temp = num; 20 while (temp > 0) 21 { 22 rev = (rev * 10) + (temp % 10); 23 temp /= 10; 24 } 25 printf("\nReverse of the number %d : %d", num, rev); 26 return 0; 27 }