bsc

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

luc038.c (760B)


      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 /* Write a program to generate all Pythagorean Triplets with slide
      8 length less than or equal to 30. */
      9 /* Let Us C, Chap- 6, Page - 106, Qn No.: B(e) */
     10 
     11 #include <stdio.h>
     12 #include <math.h>
     13 
     14 int main()
     15 {
     16     int a, b, c;
     17     printf("Pythagorean Triplets with slide length less than or equal to 30 : \n");
     18     for (a = 1; a <= 30; a++)
     19     {
     20         for (b = a; b <= 30; b++)
     21         {
     22             int c_square = a * a + b * b;
     23             for (c = b + 1; c <= 30; c++)
     24             {
     25                 if (c * c == c_square)
     26                     printf("(%d, %d, %d)\n", a, b, c);
     27             }
     28         }
     29     }
     30     return 0;
     31 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror