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

17
level2/11.rb Executable file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
=begin
두 수를 받아 더한 값을 반환하는 메서드 작성
=end
def add(a, b)
a + b
end
print "숫자 1: "
number1 = gets.chomp.to_i
print "숫자 2: "
number2 = gets.chomp.to_i
puts "#{number1} + #{number2} = #{add(number1, number2)}"