106. Calculator
#include<stdio.h>
char
ch;
int
num1,num2,num3=0;
void
main()
{
printf("Basic Calculator \n");
printf("Enter the number 1 : ");
scanf("%d",&num1);
printf("Enter the number 2 : ");
scanf("%d",&num2);
printf(" + Addition\n - Subtraction\n
* Multiplication\n / Division\nEnter the operation : ");
scanf(" %c",&ch);
switch(ch)
{
case '+' :
num3=num1+num2;
printf("%d\n",num3);
break;
case '-' :
num3=num1-num2;
printf("%d\n",num3);
break;
case '*' :
num3=num1*num2;
printf("%d\n",num3);
break;
case '/' :
num3=num1/num2;
printf("%d\n",num3);
break;
default :
printf("Invalid
Input\n");
}
}
Comments
Post a Comment