Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- int input,a,b,result;
- char x;
- do{
- printf("Calculator:\n");
- printf("\nEnter 1 for Addition:\n ");
- printf("Enter 2 for Subtraction:\n ");
- printf("Enter 3 for Multiplication:\n ");
- printf("Enter 4 for Division:\n ");
- scanf("%d",&input);
- printf("Enter number 01:\n");
- scanf("%d",&a);
- printf("Enter number 02:\n");
- scanf("%d",&b);
- switch(x){
- case 1 : result=a+b;
- printf("The addition is : %d\n",result);
- break;
- case 2 : result=a-b;
- printf("The Substraction is : %d\n",result);
- break;
- case 3 : result=a*b;
- printf("The Multiplication is : %d\n",result);
- break;
- case 4 : result=a/b;
- printf("The division is : %d\n",result);
- break;
- default: printf("wrong input\n");
- }
- printf("Do you want to continue ? (y/n)\n");
- option=getche();
- }while(option=='y');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement