membuat trapesium dengan ruby

Saturday, April 2, 2011
print "Masukan a:"
a=gets.to_i
print "Masukan b:"
b=gets.to_i
print "Masukan c:"
c=gets.to_i

puts
printf"          %i\n",a
printf"        ------------\n"
printf"       /                 |\n"
printf"      /                  |\n"
printf"     /                   |%i\n",b
printf"    /                    |\n"
printf"   /                     |\n"
printf"  /                      |\n"
printf" /___________|\n"
printf"       %i\n",c


e=(a+c)*b/2
print "Luas Trapesium adalah:",e

0 comments:

Post a Comment