//asking for input or operation to be used
printf ("\n\n\tEnter choice: ");
scanf ("%d",&oper);
//case addition
switch (oper)
{
case 1:
//initializing variables
int a, numa1, numa2;
//asking for first input
printf ("\n\n\tEnter input 1: ");
scanf ("%d",&numa1);
//asking for second input
printf ("\n\n\tEnter input 2: ");
scanf ("%d",&numa2);
//when operation is addition
a = numa1+numa2;
printf ("\n\n\tThe sum of %d and %d is %d",numa1,numa2,a);
break;
case 2:
//initializing variables
int s, nums1, nums2;
//asking for first input
printf ("\n\n\tEnter input 1: ");
scanf ("%d",&nums1);
//asking for second input
printf ("\n\n\tEnter input 2: ");
scanf ("%d",&nums2);
//when operation is subtraction
s = nums1-nums2;
printf ("\n\n\tThe difference between %d and %d is %d",nums1,nums2,s);
break;
case 3:
//initializing variables
int m, numm1, numm2;
//asking for first input
printf ("\n\n\tEnter input 1: ");
scanf ("%d",&numm1);
//asking for second input
printf ("\n\n\tEnter input 2: ");
scanf ("%d",&numm2);
//when operation is multiplication
m = numm1*numm2;
printf ("\n\n\tThe product of %d and %d is %d",numm1,numm2,m);
break;
case 4:
//initializing variables
float d, numd1, numd2;
//asking for first input
printf ("\n\n\tEnter input 1: ");
scanf ("%f",&numd1);
//asking for second input
printf ("\n\n\tEnter input 2: ");
scanf ("%f",&numd2);
//when operation is division
d = numd1/numd2;
printf ("\n\n\tThe quotient of %.0f and %.0f is %.2f",numd1,numd2,d);
break;
default:
//when operation is not valid
printf ("\n\n\tNo equivalent operation found for %d",oper);
break;
}
printf ("\n\n\tDo you want to try again? Y/N: ");
scanf ("%s",&yesorno);
switch (tolower(yesorno));
}while (yesorno='y');