Calculator Operation Using Switch Case C program
This program specially for Calculator Operation Using Switch Case C program which can do Addition,Subtractions,Multiplication,Division mathematical operations. It also has Menu to do Such Options in Simple Formats/* Program For Addition,Subtraction,Division,Multiplication*/ #include<stdio.h> int main() { int a,b,c; while(1) { printf("\n****Choose The Following Options****\n"); printf("-Press 1 for Additions\n"); printf("-Press 2 for Subtractions\n"); printf("-Press 3 for Multiplication\n"); printf("-Press 4 for Divisions\n"); printf("-Press 5 for Exit\n"); scanf("%d",&c); if(c==5) break; printf("Please Enter two nos:"); scanf("%d %d",&a,&b); switch(c) { case 1:printf("\nAdditions is:\t%d",a+b); break; case 2:printf("\nSubtractions is:\t%d",a-b); break; case 3:printf("\nMultiplication is:\t%d",a*b); break; case 4:printf("\nDivision is:\t%d",a/b); break; default:printf("\n Invalid Choice....!\n"); continue; } } return 0; }
0 comments:
Post a Comment