C program for floating point arithmetic operation

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.


Data types, input output functions, etc.


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.


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


Leave a Reply

%d bloggers like this: