APC-PRAC-038.c (1069B)
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 Print all combinations of two two-digit numbers such that the sum of digits of both numbers is equal. 9 Example: 23 and 41 → (2+3) = 5, (4+1) = 5. 10 */ 11 /* Author: Amit Dutta, Date: 21-11-2025 */ 12 13 // This code has not been compiled. 14 // If you find any issues, please create a new issue on GitHub regarding them. 15 // Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues 16 17 #include <stdio.h> 18 19 int main() 20 { 21 printf("Combinations of two two-digit numbers such that the sum of digits of both numbers is equal: "); 22 int i, j, sum1, sum2, count = 0; 23 for (i = 10; i <= 99; i++) 24 { 25 sum1 = (i % 10) + (i / 10); 26 for (j = i + 1; j <= 99; j++) 27 { 28 sum2 = (j % 10) + (j / 10); 29 if (sum1 == sum2) 30 { 31 printf("(%d, %d) ", i, j); 32 count++; 33 } 34 } 35 } 36 printf("\nCount: %d\n", count); 37 return 0; 38 }