answersLogoWhite

0

A Switch statement can be considered as a series of if. else if. else statements. whatever condition is satisfied, the code block would get executed.

if (cond 1) {

} else if (cond 2) {

} else if (cond 3) {

} ......

} else if (cond N) {

} else {

}

switch {

case 1: ....

case 2: ....

....

case N: ...

default: ...

}

Difference:

In the if else blocks, if one condition is satisfied, all other blocks are ignored

In Switch blocks, unless you have break statements inside each condition block, the subsequent blocks would not be ignored.

User Avatar

Wiki User

16y ago

What else can I help you with?

Continue Learning about Engineering
Related Questions

What value is assigned to the type int variable ans in this statement if the value of p is 100 and q is 50?

It is not possible to answer this question without knowing the actual expression used in the assignment statement. The following are merely example expressions showing some of the values that could be assigned to ans: int ans, p=100, q=50; ans = p + q; // ans = 150 ans = p * q; // ans = 5000 ans = p - q; // ans = -50 ans = p / q; // ans = 2 ans = p % q; // ans = 0


What is the similarity between absolute ans relative dating?

It is the method of descovering the methodof the age of something... I think it is the age of the fossil u are trying to find out


Where is the neutral switch located on a 1996 Geo Tracker?

There is no neutral safety switch it is a clutch position switch ans is loacted in the floor in front of the clutch pedal


How you use multiple programs in switch statement in c language?

program#include#include#includevoid main(){int a,b,ans,ch;clrscr();printf("enter the value of a and b");scanf("%d%d",&a,&b);printf("1.Addition");printf("\n2.Subtraction");printf("\n3.Multiplication");printf("\n4. exit");printf("enter your choice");scanf("%d",&ch);switch(ch){case 1:ans=a+b;printf("\nAfter Addition:%d",ans);break;case 2:ans=a-b;printf("\nAfter Subtraction:%d",ans);break;case 3:ans=a*b;printf("\nAfter Multiplication:%d",ans);break;case 4:exit(0);break;}getch();}


Is engineering a poor career choice?

Short Ans YES! Long Ans It depends, where R U? Do U want to work in the USA? How old R U? What kind of Engineer where U thinking about? Now ans these ques and we can have a real ans that applies to U not just a blanket statement.


Difference between section and article?

no ans


What is the difference between primary ans secondary industry?

secondary is cooler


What is Halfway number between 47 and 91?

Ans- its 69


What is the tube after the epididymis?

The vas deferens is between the epididymis ans the urethra.


What was the relation between hazrat Muhammad saw and hazrat ans bin malik RA?

Mother of H. Ans gave her son to prophet .H. Ans is narrator of large number of Hadith. He is companion of Prophet .


1997 Toyota rav4 cooling fans come on as soon as the switch is turned on ans stay on until key is turned off what is the problem?

coolant temp switch or fan relay are bad.


When is joe cheng married Ariel lin in real life?

i think they are not married because there is no statement the one who can ans only is ariel lin