Vidyalelo
Ruby Programming · Q45

Control Structures in Ruby

Programming · Ruby Programming · question 45

Q45

What is the output of the given code? x=1 if x > 2 puts "x is greater than 2" elsif x <= 2 and x!=0 puts "x is 1" else puts "I can't guess the number" end

A.
x is greater than 2
B.
x is 1
Answer
C.
I can't guess the number
D.
None of the mentioned

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board