int main()
{
char choice;
float num1, num2, ans;
printf ("Please choose an option from the following Menu:\n");
printf ("A: Add two numbers.\n");
printf ("S: Subtract two numbers.\n");
printf ("M: Multiply two numbers.\n");
printf ("D: Devide two numbers.\n");
printf ("E: Exit this program.\n");
scanf ("%c",&choice);
if ((choice != 'A') && (choice != 'S') && (choice != 'M') && (choice != 'D') && (choice != 'E'))
{
printf ("\nYou did not enter an available option!\nPlease remember to capitalize options. ");
exit(1);
}
else if (choice == 'E')
{
printf ("\nThank you for trying to use the program.\n");
exit(1);
}
printf ("Please enter two numbers:\n");
scanf ("%f %f",&num1,&num2);
if (choice == 'A')
{
ans = num1 + num2;
printf ("\nThe sum of %.2f + %.2f is equal to %.2f \n", num1, num2, ans);
}
else if (choice == 'S')
{
ans = num1 - num2;
printf ("\nThe difference between %.2f and %.2f is equal to %.2f \n", num1, num2, ans);
}
else if (choice == 'M')
{
ans = num1 * num2;
printf ("\nThe the product of %.2f * %.2f is equal to %.2f \n", num1, num2, ans);
}
else if (choice == 'D')
{
ans = num1/num2;
printf ("\n%.2f devided by %.2f is equal to %.2f \n", num1, num2, ans);
}
return 0;
}