Algorithms_in_C 1.0.0
Set of algorithms implemented in C.
Loading...
Searching...
No Matches
sol1.c File Reference

Problem 9 solution - A naive implementation More...

#include <stdio.h>
Include dependency graph for sol1.c:

Functions

int main (void)
 Main function.
 

Detailed Description

Problem 9 solution - A naive implementation

Author
Krishna Vedala

Function Documentation

◆ main()

int main ( void  )

Main function.

11{
12 for (int a = 1; a < 300; a++)
13 for (int b = a + 1; b < 400; b++)
14 for (int c = b + 1; c < 500; c++)
15 {
16 if (a * a + b * b == c * c)
17 if (a + b + c == 1000)
18 {
19 printf("%d x %d x %d = %ld\n", a, b, c,
20 (long int)a * b * c);
21 return 0;
22 }
23 }
24
25 return 0;
26}