Discussion :: Control Structures
-
What's wrong in the following statement, provided k is a variable of type int?
for(k = 2, k <=12, k++)
A.
The increment should always be ++k . |
B.
The variable must always be the letter i when using a for loop. |
C.
There should be a semicolon at the end of the statement. |
D.
The variable k can’t be initialized. |
E.
The commas should be semicolons. |
Answer : Option E
Explanation :
In for loop the three statements parts are separated by two semicolons which are missing here.
Be The First To Comment