APC-PRAC-038.c
Problem Statement
APC-PRAC-038.c
Print all combinations of two two-digit numbers such that the sum of digits of both numbers is equal. Example: 23 and 41 → (2+3) = 5, (4+1) = 5.
Source Code
c
#include <stdio.h>
int main()
{
printf("Combinations of two two-digit numbers such that the sum of digits of both numbers is equal: ");
int i, j, sum1, sum2, count = 0;
for (i = 10; i <= 99; i++)
{
sum1 = (i % 10) + (i / 10);
for (j = i + 1; j <= 99; j++)
{
sum2 = (j % 10) + (j / 10);
if (sum1 == sum2)
{
printf("(%d, %d) ", i, j);
count++;
}
}
}
printf("\nCount: %d\n", count);
return 0;
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
● Author - Amit Dutta · Updated - 12 Dec 2025