QP School

Full Version: Basic arithmetic operations with the double datatype in C
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Example:

double x = 5.5;
double y = 2.5;
double sum = x + y;
double difference = x - y;
double product = x * y;
double quotient = x / y;

Explanation:

In this example, we declare several double variables (x, y, sum, difference, product, and quotient).
We perform basic arithmetic operations using these variables.
sum stores the result of adding x and y.
difference stores the result of subtracting y from x.
product stores the result of multiplying x and y.
quotient stores the result of dividing x by y.