summary refs log tree commit diff
path: root/minic/test/euler9.c
blob: ec85b8638791b0d291ea1ef29ad99840b5611c88 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <stdio.h>

main()
{
	int i;
	int a;
	int b;
	int c;
	int d;
	
	for (a = 1; a < 1000; a++) {
		for (b = a + 1; b < 1000; b++) {
			d = a*a + b*b;
			for (i = 0; i < 1000; i++) {
				if (i * i == d) {
					c = i;
					if (b < c && a+b+c == 1000) {
						printf("%d\n", a*b*c);
						return 0;
					}
					break;
				}
			}
		}
	}
}