# Calculation of two user entered numbers

We can ask users to enter two numbers and we can return SUM, Subtraction, multiplication or division of two numbers. Before asking two numbers we will take an option from the user what they want to do.
``````If the user enters A then we will go for addition of two numbers.
If the user enters B then we will go for subtraction of two numbers
If the user enters C then we will go for multiplication of two numbers
If the user enters D then we will go for division of two numbers ``````
Here is the code. WE used switch here.
``````#include <stdio.h>
int main(void){
char var;
int num1,num2,v;
printf(" Please enter A, B, C or D \n");
var=getchar();
printf("Enter the two numbers ");
scanf("%d %d",&num1,&num2); // Enter two numbers
switch(var)
{
case 'A':

v=num1+num2;
printf("Sum of two numbers are  ");
printf("\n");
printf("%d",v);
break;

case 'B':
v=num1-num2;
printf("Subtraction of two nmbers are  ");
printf("\n");
printf("%d",v);
break;

case 'C':
v=num1*num2;
printf("Mulitplication of two numbers are ");
printf("\n");
printf("%d",v);
break;

case 'D':
v=num1/num2;
printf("Division of two numbers are ");
printf("\n");
printf("%d",v);
break;

default:
printf("You entered section ");
}
return 0;
}`````` plus2net.com