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