Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What is the output of given code?
counter=1
if counter<=5
puts (counter)
counter=counter+1
else
puts(counter)
counter=counter-1
end

What is the output of given code?
counter=1
if counter<=5
puts (counter)
counter=counter+1
else
puts(counter)
counter=counter-1
end
a) 1, 2
b) 1,2,3,4,5
c) 1 2 1
d) 1
2

Answer: d
Explanation: Value of counter is printed and then incremented.
Output:
1
2

Join The Discussion