#include<stdio.h> main() { /* Local Definitions */ float a = 14.0; float b = 5.0; /*Statements*/ 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 :
14.000000 + 5.000000 = 19.000000 14.000000 - 5.000000 = 9.000000 14.000000 * 5.000000 = 70.000000 14.000000 / 5.000000 = 2.800000
Floating Pointer Can perform following Operations :
- Addition
- Subtraction
- Division
- Multiplication
Note : Floating Point Data Type Can’t Perform Modulus Operation
#include<stdio.h> main() { float a = 14.0; float b = 5.0; printf("%f %% %f = %fn", a ,b, a % b); }
Output :
Compile Error : Illegal Use of Floating Point
No comments:
Post a Comment