Codes: part 25

public class diopenta{
public static void main (String[] args){
long st = System.currentTimeMillis();
int a1,b1,c1,d1;
for(int a=1; a<20; a++){
a1 = a*a*a*a*a;
for(int b=1; b<20; b++){
b1=b*b*b*b*b;
for(int c=a+1; c<20; c++){
c1 = c*c*c*c*c;
for(int d=c; d<20; d++){
d1= d*d*d*d*d;
if (a1+b1 == c1+d1){
System.out.println((a1+b1)+” = “+a+”^5 + “+b+”^5 = “+c+”^5 + “+d+”^5”);}}}}}
long et = System.currentTimeMillis();
System.out.println(“elapsed time = ” + (et-st)/1000.0 + ” sec”);
System.out.println(“”);
}}

Advertisements