Multiple choice technology web technology

How do you write a conditional statement for executing some code if "i" is equal to 5?

  1. if i==5 then

  2. if i=5

  3. if (i==5)

  4. if i=5 then

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In C-style languages (C, C++, Java, C#), conditional statements require parentheses around the condition. Option C 'if (i==5)' is correct syntax with parentheses and the equality operator ==. Options A and D use 'then' keyword which isn't valid in these languages. Options B and D use single = which is assignment, not comparison.