bsc

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

root / semester_1 / practice-c / pc010.c

pc010.c (412B)


      1 /* Reverse a number */
      2 
      3 #include <stdio.h>
      4 int main()
      5 {
      6     int num, temp, rev = 0;
      7     printf("\nEnter the number : ");
      8     if (scanf("%d", &num) != 1)
      9     {
     10         printf("\nOnly a number is allowed.");
     11         return 1;
     12     }
     13     temp = num;
     14     while (temp > 0)
     15     {
     16         rev = (rev * 10) + (temp % 10);
     17         temp /= 10;
     18     }
     19     printf("\nReverse of the number %d : %d", num, rev);
     20     return 0;
     21 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror