/* C Program to write a simple calculator to preform addition, subtraction, multiplication
and division operations */
#include <stdio.h>
#include <stdlib.h>
int main()
{
int num1;
int num2;
float result;
int choice;
printf("Enter the first number\n");
scanf("%d",&num1);
printf("Enter the second number\n");
scanf("%d",&num2);
printf("Enter the number of the operation you want to perform on the two entered numbers\n");
printf("1. Addition\n");
printf("2. Subtraction\n");
printf("3. Multiplication\n");
printf("4. Division\n");
scanf("%d",&choice);
switch(choice)
{
case 1:
result=num1+num2;
printf("Result is %f",result);
break;
case 2:
result=num1-num2;
printf("Result is %f",result);
break;
case 3:
result=num1*num2;
printf("Result is %f",result);
break;
case 4:
result=(float)num1/num2;
printf("Result is %f",result);
break;
default:
printf("Invalid choice\n");
}
return 0;
}