#include<stdio.h>
int main()
{ int selection;
printf("this is a program to build a calculator program \n");
printf("for addition press 1 \n");
printf("for multiplication press 2 \n");
printf("for subtraction enter 3 \n");
printf("for division enter 4 \n"); /* this is cool */
scanf("%d",&selection);
switch(selection)
{
case 1: printf("ADDITION \n"); /* this is for addition */
int a,b,c;
printf("enter a value into a \n");
scanf("%d",&a);
printf("enter a value into b \n");
scanf("%d",&b);
c=a+b; /*logic of the addition phase */
printf("the answer is %d \n",c);
break;
case 2: printf("MULTIPLICATION \n"); /* this is for multiplication */
int e,f,g; /* here we took variables to store values in it */
printf("enter a value for a \n");
scanf("%d",&e);
printf("enter a value for b \n");
scanf("%d",&f);
g=e*f; /* logic of the multiplication phase */
printf("the answer is %d \n",g);
break;
case 3: printf("SUBTRACTION \n");
int h,i,j;
printf("enter a value for a /n");
scanf("%d",&h);
printf("enter a value for b \n");
scanf("%d",&i);
j=h-i; /* this is the logic for subtraction */
printf("the answer is %d ",j);
break ;
case 4: printf("DIVISION \n");
float k,l,m;
printf("enter a value into a \n");
scanf("%f",&i);
printf("enter a value into b \n");
scanf("%f",&m);
k=i/m; /*this is the logic used for division */
printf("the answer is %.2f \n",k);
break;
default: printf("error \n");
break; /* this is used to break the execution of the program */
}
getchar();
return 0; /* this return a value */
}