Computer Science, asked by Shifapathan, 11 months ago

Explain the switch statement and for loop control structure with syntax...

Answers

Answered by dessuabewa
3

switch statement is a selection statement which executes statements only in the matching case only.

syntax

cin>>operator;

switch(operator){

case '+':

cout<<a+b;

break;

case 'n':

statement 1;

statement n;

break;

default:

statement;

notice that break and switch are optional.

for loop is an iteration statement which repeats a statement until the loop  condition fails or become false.

for(intialization;condition;assignment)

statement;

example   for(int i=0;i<5;i++)

     sum=sum+i;

for(;;) is also legal which is called infinite loop.


Shifapathan: thank you!
Answered by Anonymous
4
\huge{\bold{\red{Heya!!!}}}

\bold{\blue{Here\:is\:your\: answer\: }}
Attachments:
Similar questions