CS 200 - Lab 4

Expensive Calculator

Your task in this lab is to read two double values from the user, and print out their sum, difference, product, and quotient.

Here is an example run of the program (user input in bold red):
Enter first value: 8.5
Enter second value: 4
8.500 + 4.000 = 12.500
8.500 - 4.000 = 4.500
8.500 * 4.000 = 34.000
8.500 / 4.000 = 2.125

Each quantity printed should have three digits of precision after the decimal point.

Getting started

Start by downloading lab4.zip and using the File->Import... menu option to import it into VIsual Studio.  Add your code to the source file Calculator.c.


Store the two input values in variables of type double.

Use the printf function to prompt the user for the two values and also to print out the computed results.  The %f conversion specifier may be used to print values of type double.

Use the scanf function to read values typed by the user into your double variables.  Use the %lf conversion specifier (that's "percent", "lower-case L", "lower-case F").  Note: the %f conversion specifier will not work correctly for a double variable.