Back-end
[루비] 루비 숫자 다루고 변환 메서드
jhkang-dev
2018. 12. 21. 16:43
puts "Simple calculator"
25.times {print "-"}
puts "Enter the first Number"
num_1=gets.chomp
puts "Enter the second Number"
#gets.chomp는 String으로 받아온다.
num_2=gets.chomp
puts "The first number multipled by the second number is #{num_1.to_i * num_2.to_i}"
puts "나누기 : The first number division by the second number is #{num_1.to_i / num_2.to_i}"
puts "더하기 : The first number plus by the second number is #{num_1.to_i + num_2.to_i}"
puts "빼기 : The first number minus by the second number is #{num_1.to_i - num_2.to_i}"
num_3=10
puts "#{num_3.to_f}"
puts "#{num_3.odd?}"
puts "#{num_3.even?}"