Calc

Create a simple command line calculator.

$ ./calc 50 x 28
1400.000000

Create a new file called calc.c.

Input to the program will use the command line. The user should provide three items on the command line for basic calculations - addition, subtraction, multiplication, and division - on floating point numbers:

$ ./calc 8.38 - 5.12
3.2600000

You may assume the following:

Optional (for more of a challenge)

You may modify your program to accept the % operator. Note that in C, % only works with integers - you’ll have to find a way to calculate the remainder when using floats.

Test your code

Test your code with:

check50 scienceacademy/problems/2024ap/calc

Note: The checker will test for the optional case. You can ignore those errors if you opted to skip that.