Basic I/O II | |
![]() |
![]() |
io3.rb | File I/O![]() |
print "Triangle height: " h = gets.to_f; print "Triangle width: " w = gets.to_f; area = 0.5*h*w print "Triangle height ", h, " width ", w, " has area ", area, "\n"
to_f
method of
class String
converts the input string to a floating-point
number.
![]() |
File I/O![]() |