Write the syntax for the following.
→ for loop
while loop
do while loop
A
Answers
Answered by
1
Answer:
Syntax for loop:-
for(initial value; condition;increment/decrement operator)
{
Statements
}
Syntax while loop:-
while(condition)
{
Statements
Increment/Decrement operator;
}
Note:In while loop the incremented/decremented operator can be also be applied before the statements like but note in syntax in both while and do while loop increment/ decrement operator is not mandatory to write as it comes under the statements.
while(condition)
{
Increment/Decrement operator
Statements
}
Syntax do-while loop:-
do
{
Statements
}
while(condition);
increment/decrement operator;
Similar questions