bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

luc010.c (960B)


      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 /* A five-digit number is entered through the keyboard. Write a program
      8 to obtain the reversed number and to etermine whether the original and reversed
      9 numbers are equal or not. */
     10 /* Let Us C, Chap - 3, Page - 53, Qn No.: f(a) */
     11 
     12 #include <stdio.h>
     13 int main()
     14 {
     15     int num, rev, temp, i;
     16     printf("Please enter the number : ");
     17     scanf("%d", &num);
     18     if (num < 10000 || num > 99999)
     19     {
     20         printf("\nPlease enter a five digit number.");
     21         return 1;
     22     }
     23     temp = num;
     24     for (i = 1; i <= 5; i++)
     25     {
     26         rev = (rev * 10) + num % 10;
     27         num = num / 10;
     28     }
     29     printf("\nReverse of the Input number : %d", rev);
     30     if (rev == temp)
     31         printf("\nOriginal and reversed numbers are equal.");
     32     else
     33         printf("\nOrigianl and reversed numbers are not equal.");
     34     return 0;
     35 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror