0

Can anyone tell me how to use two gets method in the same program..

puts "ENTER A NUMBER : " num1 = gets chomp puts "ENTER ANOTHER NUMBER : " num2 = gets.chomp puts (num1 + num2)

14th Apr 2020, 9:00 AM
Aaditya Damani
11 ответов
+ 2
Above in 2nd line gets chomp must be gets.chomp
14th Apr 2020, 9:04 AM
Raj Kalash Tiwari
Raj Kalash Tiwari - avatar
+ 2
puts "ENTER A NUMBER : " num1 = gets.chomp puts "ENTER ANOTHER NUMBER : " num2 = gets.chomp puts (num1 + num2)
14th Apr 2020, 9:16 AM
Raj Kalash Tiwari
Raj Kalash Tiwari - avatar
+ 2
Now try it
14th Apr 2020, 9:17 AM
Raj Kalash Tiwari
Raj Kalash Tiwari - avatar
+ 2
Had you copied same code as i had given
14th Apr 2020, 9:20 AM
Raj Kalash Tiwari
Raj Kalash Tiwari - avatar
+ 2
Bro actually your code is correct there only one(. ) is missing in 2nd line of code num1=gets.chomp
14th Apr 2020, 9:21 AM
Raj Kalash Tiwari
Raj Kalash Tiwari - avatar
+ 1
Ok
14th Apr 2020, 9:18 AM
Aaditya Damani
+ 1
Ok
14th Apr 2020, 9:22 AM
Aaditya Damani
0
Raj Kalash Tiwari can you plz write the code and message it to me as i cannot understand this
14th Apr 2020, 9:16 AM
Aaditya Damani
0
Sorry it is showing an error
14th Apr 2020, 9:19 AM
Aaditya Damani
0
Yes i had copied the same
14th Apr 2020, 9:22 AM
Aaditya Damani
0
Thanks for ypur opinion now i have done it
14th Apr 2020, 10:14 AM
Aaditya Damani