source file name: switch3.C

#include <stdio.h>

int  main()

{

char op;

int a,b,res;

//clrscr();

printf("\n enter 2 numbers ");

scanf("%d%d",&a,&b);

printf("\n enter any operation ");

scanf(" %c",&op);

switch(op)

{

case 'a': res=a+b; printf("\n result=%d ",res); break;

case 's': res=a-b; printf("\n result=%d ",res);   break;

case 'm': res=a*b; printf("\n result=%d ",res); break;

case 'd': res=a/b; printf("\n result=%d ",res);   break;

default:

printf ("\n  no valid operation");     break;

}

//getch();

return 0;

}

output: