Codes: part 73

#!/usr/bin/ruby
include Math
require “mathn”
a=0
while a<=3
a +=1
sum1=a*a
b=0
while b<=3
b +=1
if a<=b
sum2=b*b
sum3=sum1+sum2
c=0
while c<=3
c +=1
sum4=c*c
d=0
while d<=3
d +=1
if c<=d
sum5=d*d
e=0
while e<=4
e +=1
if d<=e
sum6=e*e
sum7=sum4+sum5+sum6
if sum3 == sum7
print("",sum3," = ","",a,"^2 + ","",b,"^2", " = ","",c,"^2 + ","",d,"^2 + ",
"", e,"^2""\n")
end end end
end end end
end end end

 

Advertisements