qbe

Internal scc patchset buffer for QBE
Log | Files | Refs | README | LICENSE

euler9.c (340B)


      1 #include <stdio.h>
      2 
      3 main()
      4 {
      5 	int i;
      6 	int a;
      7 	int b;
      8 	int c;
      9 	int d;
     10 	
     11 	for (a = 1; a < 1000; a++) {
     12 		for (b = a + 1; b < 1000; b++) {
     13 			d = a*a + b*b;
     14 			for (i = 0; i < 1000; i++) {
     15 				if (i * i == d) {
     16 					c = i;
     17 					if (b < c && a+b+c == 1000) {
     18 						printf("%d\n", a*b*c);
     19 						return 0;
     20 					}
     21 					break;
     22 				}
     23 			}
     24 		}
     25 	}
     26 }
     27