0% found this document useful (0 votes)
11 views

Switch Case Program

Uploaded by

shivatyagi066
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Switch Case Program

Uploaded by

shivatyagi066
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <stdio.

h>

int main()

int operand1,operand2,sum,diff,mul,division;

char operator;

while(1){

printf("**************************************************************\n");

printf("enter + for addition\n");

printf("enter - for diffrence\n");

printf("enter * for multiplication\n");

printf("enter / for division\n");

printf("***********************************************************\n");

printf("enter the value of operand1 : ");

scanf("%d",&operand1);

printf("enter the value of operator : ");

scanf(" %c",&operator);

printf("enter the value of operand2 : ");

scanf("%d",&operand2);

switch(operator){

case'+':

sum=operand1+operand2;

printf("sum of the %d and %d and %d\n",operand1,operand2,sum);

break;

case '-':

diff=operand1-operand2;

printf("diff of the %d and %d and %d\n",operand1,operand2,diff);


case '*':

mul=operand1*operand2;

printf("mul of the %d and %d and %d\n",operand1,operand2,mul);

case '/':

division=operand1/operand2;

printf("division of the %d and %d and %d\n",operand1,operand2,division);

default:

printf("invalid input");

return 0;

You might also like