answersLogoWhite

0


Best Answer

program
#include
#include
#include
void 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();
}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

If you want to execute other programs from your program, use functions like exec*, system, ShellExecute, CreateProcess(platform dependent).

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How you use multiple programs in switch statement in c language?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you choose multiple if statement and switch statement?

If you must evaluate two or more expressions separately, use multiple if statements. If you only need to test all the possible evaluations of a single expression, use a switch.


Multiple default statements in switch statement in c?

I really think this is not possible.


In computer programming what is the difference between a switch and a transistor?

In the general subject of computer programming neither switch nor transistor exist as concepts. They are out of scope.The language C (and its relatives) have a switch statement, but still no concept of transistor.The switch statement of C is a statement in the general class of multiple way decision statements (aka multiple way branch statements) and are called other things in other languages:FORTRAN IV - computed GOTO statementFortran 95 - case constructBASIC - ON ... GOTO statementCOBOL - EVALUATE statementPL/1 - SELECT statementPascal - case statementAda - case statementetc.


What is regular grammar of a switch in C programming language?

Perhaps you meant 'switch statement' instead of 'a switch'?Something like this: -> -> switch () -> { } -> (empty) | -> []; -> | -> case: | default: -> | break;


Can a continue statement be used in a switch statement?

If you have a loop in your switch statement or around your switch statement, you can use the continue statement in that. You cannot use a continue statement outside of a loop (do, for, or while).

Related questions

What is the difference between 'switch' statement and 'if' statement?

we can use switch statement in multiple time but in if statement we can not use multiple time


What is the deffernce of the switch statement and the if statement in c plus plus?

If statement is single selection statement,whereas the switch statement is multiple selective.


How 'if' statement is different from a 'switch' statement in C language?

The if statement is used to select among two alternatives. It uses a boolean expression todecide which alternative should be executed. The switch statement is used to select among multiple alternatives. It uses an int expression to determine which alternativeshould be executed.


Can you have nested switch statement inc language?

yes,we can


How do you choose multiple if statement and switch statement?

If you must evaluate two or more expressions separately, use multiple if statements. If you only need to test all the possible evaluations of a single expression, use a switch.


Multiple default statements in switch statement in c?

I really think this is not possible.


In computer programming what is the difference between a switch and a transistor?

In the general subject of computer programming neither switch nor transistor exist as concepts. They are out of scope.The language C (and its relatives) have a switch statement, but still no concept of transistor.The switch statement of C is a statement in the general class of multiple way decision statements (aka multiple way branch statements) and are called other things in other languages:FORTRAN IV - computed GOTO statementFortran 95 - case constructBASIC - ON ... GOTO statementCOBOL - EVALUATE statementPL/1 - SELECT statementPascal - case statementAda - case statementetc.


What is regular grammar of a switch in C programming language?

Perhaps you meant 'switch statement' instead of 'a switch'?Something like this: -> -> switch () -> { } -> (empty) | -> []; -> | -> case: | default: -> | break;


How if else if statement is differ from switch in general in java?

An else statement is comparing to items, while a switch statement is used to compare multiple items. So if you need multiple results from one statement use a switch but for booleans or very specific functions use a if else statement. Else If ex. if(a=6){System.out.println("It is six");} else(){System.out.println("It is not six");} Switch ex. switch(a){ case 1: System.out.println("it is one"); break; case 2: System.out.println("it is two"); break; default: System.out.println("it is not one or two"); break; } Basically a switch is a good way to check against a lot of possibilities.


Can a continue statement be used in a switch statement?

If you have a loop in your switch statement or around your switch statement, you can use the continue statement in that. You cannot use a continue statement outside of a loop (do, for, or while).


What is the use of Default statement in switch case?

C++ Provides a multiple branch selection called as switch. This selection statement succesively test against a list of integer or character constants. When a match is found the statements associate with constants are executed. When no match is found default statement is used.


What are the disadvantages of switch statement in C-language?

In some languages and programming environments, a case or switch statement is considered easier to read and maintain than an equivalent series of if-else statements, because it is more concise. However, when implemented with fall-through, switch statements are a frequent source of bugs among programmers new to the switch statement.