In this program, we will discuss how to do floating point arithmetic operations. Floating point operations has their output values with decimal point that means there will be no certain value and it can be set to round figure by adjusting it.

**Pre-requisites:**

Data types, input output functions, etc.

**Approach:**

Either we can take input values from user which will be floating point numbers or we will initialize the variables to floating point values in source code.

To display result, we must use %f format specifier in input output statements so that correct value is displayed on screen.

If we want control how many digits should appear after decimal point then we can do formatting in printf statement.

e.g. %.2f can be used when we want to display only 2 digits after decimal point.

## Program:

/*P4.2 Program to understand the floating point arithmetic operation */

1 2 3 4 5 6 7 8 9 10 |
#include<stdio.h> int main() { float num1=8.2,num2=4.4; printf("Sum=%.2f\n",num1+num2); printf("Difference=%.2f\n",num1-num2); printf("Product=%.2f\n",num1*num2); printf("Division=%.2f\n",num1/num2); return 0; } |

### Output:

1 2 3 4 |
Sum=12.60 Difference=3.80 Product=36.08 Division=1.86 |