bsc

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

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

APC-PRAC-038.c (933B)


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