bsc

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

root / semester_1 / tuition-c / APC-PRAC-035.c

APC-PRAC-035.c (751B)


      1 /* Print all the 3 and 4 digit palindrome number. */
      2 /* Auhtor: Amit Dutta, Date: 20-11-2025 */
      3 
      4 // This code has not been compiled.
      5 // If you find any issues, please create a new issue on GitHub regarding them.
      6 // Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues
      7 
      8 #include <stdio.h>
      9 
     10 int palindromeCheck(int);
     11 
     12 int palindromeCheck(int n)
     13 {
     14     int temp = n, rev = 0;
     15     while (temp > 0)
     16     {
     17         rev = (rev * 10) + (temp % 10);
     18         temp /= 10;
     19     }
     20     if (rev == n)
     21         return 1;
     22     else
     23         return 0;
     24 }
     25 
     26 int main()
     27 {
     28     int i;
     29     printf("Palindrome number of 3 and 4 digits:  ");
     30     for (i = 100; i <= 9999; i++)
     31         if (palindromeCheck(i))
     32             printf("%d  ", i);
     33     return 0;
     34 }
© 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