#include <stdio.h>
main()
{
float number1;
char operation;
float number2;
float answer;
printf("enter a number, then press enter: ");
scanf("%f", &number1);
printf("\nenter an operation, be it plus (+), minus (-), times (*), or divided by (/), then press enter: ");
scanf("%c", operation);
printf("\nenter another number, then press enter: ");
scanf("%f", &number2);
if (operation == '+')
answer = number1 + number2;
if (operation == '-')
answer = number1 - number2;
if (operation == '*')
answer = number1 * number2;
if (operation == '/')
answer = number1 / number2;
printf("\nenter an operation, be it plus (+), minus (-), times (*), or divided by (/), then press enter. If you're done with your calculation then enter \"end\" (no quotes) and press enter: ");
scanf ("%c", operation);
while (operation != 'end') {
if (operation == '+')
printf("\nenter another number, then press enter: ");
scanf("%f", &number2);
answer = answer + number2;
printf("\nenter an operation, be it plus (+), minus (-), times (*), or divided by (/), then press enter. If you're done with your calculation then enter \"end\" (no quotes) and press enter: ");
scanf("%c", operation);
else if (operation == '-')
printf("\nenter another number, then press enter: ");
scanf("%f", &number2);
answer = answer - number2;
printf("\nenter an operation, be it plus (+), minus (-), times (*), or divided by (/), then press enter. If you're done with your calculation then enter \"end\" (no quotes) and press enter: ");
scanf("%c", operation);
else if (operation == '*')
printf("\nenter another number, then press enter: ");
scanf("%f", &number2);
answer = answer * number2;
printf("\nenter an operation, be it plus (+), minus (-), times (*), or divided by (/), then press enter. If you're done with your calculation then enter \"end\" (no quotes) and press enter: ");
scanf("%c", operation);
else if (operation == '/')
printf("\nenter another number, then press enter: ");
scanf("%f", &number2);
answer = answer / number2;
printf("\nenter an operation, be it plus (+), minus (-), times (*), or divided by (/), then press enter. If you're done with your calculation then enter \"end\" (no quotes) and press enter: ");
scanf("%c", operation);
else if (operation != '+' | operation != '-' | operation != '*' | operation != '/')
printf("\nthat's not a valid operation! Enter a correct operation: plus (+), minus (-), times (*), or divided by (/), then press enter. If you're done with your calculation then enter \"end\" (no quotes) and press enter: ");
scanf("%c", operation);
else
printf("\nthat's not a valid operation! Enter a correct operation: plus (+), minus (-), times (*), or divided by (/), then press enter. If you're done with your calculation then enter \"end\" (no quotes) and press enter: ");
scanf("%c", operation);
}
printf("\nThe answer to your operation is %f.\n", answer);
}