Saturday, April 14, 2012

Cara membuat luas segitiga menggunakan ruby

print "masukkan tinggi : "
x = gets.to_i
temp = x
i = 1
while i <= x
k = 1
while temp >= 1
print " "
temp -= 1
end
while k <= i
print "* "
k+=1
end
temp = x - i
i += 1
puts""
end

No comments:

Post a Comment