/*********************************************
PROGRAM NAME- CALCULATOR
PROGRAMMER - RAJNISH KUMAR,
Editor- Turbo C++
In Thish program,i created a simpal calculator,
(Useing Switch() function.)
**********************************************/
//import header File
#include<stdio.h>
void main() //start of main() function
{
int n,num1,num2,result; //Define variable
char option;
clrscr();
/* Here, the whole program run in do-while Loop,bacause if User want
to contionu this program,they can do.*/
do{
printf("\n What opration do you want to do?\n");
printf("press 1 for addition\n");
printf("press 2 for subtraction\n");
printf("press 3 for multiplication\n");
printf("press 4 for division\n");
scanf("%d",&n);
printf("please enter a 1st number\n"); //asking for 1st Number
scanf("%d",&num1);
printf("please enter a 2nd number\n");// 2nd Number
scanf("%d",&num2);
//start of switch case function//
switch(n)
{
case 1:result=num1+num2;
printf("addition of two number is %d",result);
break;
case 2:result=num1-num2;
printf("subtraction of two number is %d",result);
break;
case 3:result=num1*num2;
printf("multiplication of two number is %d",result);
break;
case 4:result=num1/num2;
printf("division of two number is %d",result);
break;
default:printf("wrong input");
}
//End of switch function//
printf("\n do you want to continue y/n?\n"); //ask for continue or Not.
option=getche();
}
while(option=='y');
getch();
}
Thank you for your valuable feedback