Ruby Examples

This commit is contained in:
2026-01-15 14:01:21 +09:00
commit cf3d7d3296
76 changed files with 1191 additions and 0 deletions

16
level2/18.rb Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
=begin
BMI 계산 메서드 작성
=end
def bmi(kg, cm)
weight = kg.to_f
height = cm.to_f / 100
weight / (height ** 2)
end
puts "BMI = #{bmi(70, 170)}" # 24.22
puts "BMI = #{bmi(75, 175)}" # 24.5