Codes: part 7

import std.stdio;
int main( char[][] args)
{
for (int a=1;a<500;a++){
for (int b=a+1;b<500;b++){
int sum1;
sum1=a*a*a+b*b*b;
for (int c=a+1;c<b;c++){
for (int d=c;d<b;d++){
int sum2;
sum2=c*c*c+d*d*d;
if(sum1==sum2){
for (int e=c+1;e<d;e++){
for (int f=e;f<d;f++){
int sum3;
sum3=e*e*e+f*f*f;
if(sum2==sum3){
printf(“%d = %d^3 + %d^3 = %d^3 + %d^3 = %d^3 + %d^3\n”,sum1,a,b,c,d,e,f);
}}}}}}}}
return 0;
}

Advertisements