C Program to perform arithmetic operations on float
1 2 3 4 5 6 7 8 9 10 11 | #include<stdio.h> void main() { float a = 15.0; float b = 4.0; printf("%f + %f = %fn", a ,b, a + b); printf("%f - %f = %fn", a ,b, a - b); printf("%f * %f = %fn", a ,b, a * b); printf("%f / %f = %fn", a ,b, a / b); } |
Output :
1 2 3 4 | 15.000000 + 4.000000 = 19.000000 15.000000 - 4.000000 = 11.000000 15.000000 * 4.000000 = 60.000000 15.000000 / 4.000000 = 3.750000 |
Explanation :
In this example we have performed arithmetic operations in c programming.
Expression | Result |
---|---|
15.000000 + 4.000000 | 19.000000 |
15.000000 - 4.000000 | 11.000000 |
15.000000 * 4.000000 | 60.000000 |
15.000000 / 4.000000 | 3.750000 |