07-26-2023, 06:01 PM
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.
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.