Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Basic arithmetic operations with the double datatype in C
#1
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.
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  User input and output with double in C Qomplainerz 0 423 07-26-2023, 06:03 PM
Last Post: Qomplainerz
  Double datatype in C Qomplainerz 0 426 07-26-2023, 06:00 PM
Last Post: Qomplainerz
  Arithmetic operations with short int in C Qomplainerz 0 408 07-26-2023, 03:46 PM
Last Post: Qomplainerz
  Pointer arithmetic in C Qomplainerz 0 244 07-25-2023, 11:41 AM
Last Post: Qomplainerz

Forum Jump:


Users browsing this thread: 4 Guest(s)