What is the output of code corresponding to the following program segment if ?
If Age >= 18 Then
Write "You are eligible to vote."
Else
Set - Age
Write "You can vote in " + Years + " years."
End If
a. You are eligible to vote.
b. You can vote in 18 years.
c. You are not eligible to vote.
d. You cannot vote in 0 years.

Respuesta :

Answer:

a. You are eligible to vote.

Explanation:

If Age >= 18 Then

Write "You are eligible to vote."

Else

Set - Age

Write "You can vote in " + Years + " years."

End If

The above code block is an example of if-else code block. The if-else code block follow a pattern of:

If (expression) then

else

(expression)

end if

Based on the if Age>= 18 condition, the output will be "You are eligible to vote."