Which of the following for loop declaration is not valid?
A. for ( int i = 99; i >= 0; i / 9 )
B. for ( int i = 7; i <= 77; i += 7 )
C. for ( int i = 20; i >= 2; – -i )
D. for ( int i = 2; i <= 20; i = 2* i )
Answer:A
Which of the following for loop declaration is not valid?
A. for ( int i = 99; i >= 0; i / 9 ) B. for ( int i = 7; i <= 77; i += 7 ) C. for ( int i = 20; i >= 2; – -i ) D. for ( int i = 2; i <= 20; i = 2* i )
Explanation: The first option is not a valid declaration as i/9 is not declared correctly. The correct statement will be: