Ruby 03 - Konversi
puts "Program Konversi Temperature"
min=32
max=45
n=min..max
puts "fahrenheit celcius"
for f in n
c=(5.0/9.0)*(f-32)
puts " #{f} #{c.to_f.round(2)}"
end
Run :
Program Konversi Temperature
fahrenheit celcius
32 0.0
33 0.56
34 1.11
35 1.67
36 2.22
37 2.78
38 3.33
39 3.89
40 4.44
41 5.0
42 5.56
43 6.11
44 6.67
45 7.22
puts "Program Konversi Temperature"
min=32
max=45
n=min..max
puts "fahrenheit celcius"
for f in n
c=(5.0/9.0)*(f-32)
puts " #{f} #{c.to_f.round(2)}"
end
Run :
Program Konversi Temperature
fahrenheit celcius
32 0.0
33 0.56
34 1.11
35 1.67
36 2.22
37 2.78
38 3.33
39 3.89
40 4.44
41 5.0
42 5.56
43 6.11
44 6.67
45 7.22
Tidak ada komentar:
Posting Komentar