Comparing Two Integers
1 puts "enter a value for x ==>"
2 x = gets
3 x = x.to_i
4
5 puts "enter a value for y ==>"
6 y = gets
7 y = y.to_i
8
9 if x > 5 and y > 5
10 puts "x and y are greater than 5."
11 else
12 if x > 5
13 puts "only x is greater than 5."
14 else
15 if y > 5
16 puts "only y is greather than 5."
17 else
18 puts "both x and y are smaller than or equal to 5."
19
20 end
21 end
22 end
23
|