APC-PRAC-040.c (907B)
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 /* 8 Write a C program to count how many numbers between 100 and 999 have all distinct digits (e.g., 123, 709, 981). 9 */ 10 /* Author: Amit Dutta, Date: 21-11-2025 */ 11 12 // This code has not been compiled. 13 // If you find any issues, please create a new issue on GitHub regarding them. 14 // Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues 15 16 #include <stdio.h> 17 18 int main() 19 { 20 int i, count = 0, n1, n2, n3; 21 printf("Distinct numbers between 100 and 999: "); 22 for (i = 100; i <= 999; i++) 23 { 24 n1 = i / 100; 25 n2 = (i % 100) / 10; 26 n3 = i % 10; 27 if (n1 != n2 && n2 != n3 && n1 != n3) 28 { 29 printf("%d ", i); 30 count++; 31 } 32 } 33 printf("\nCount: %d\n", count); 34 return 0; 35 }