S

Shiva Ram • 30.44K Points
Instructor I

Q. Which of the following is the correct syntax for a for loop in C++?

  • (A) for(int i=0; i<5; i++)
  • (B) for(int i=0; i<=5; i++)
  • (C) for(int i=0; i<5; i++) { }
  • (D) for(int i=0; i<5) { }
  • Correct Answer - Option(A)
  • Views: 68
  • Filed under category C++

Explanation by: Shiva Ram
The correct syntax for a 'for' loop in C++ is 'for(initialization; condition; increment)'.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics