C Program To Demonstrates Binary Expressions Using Floating-Point Arithmetic

How To Write a C Program To Demonstrates Binary Expressions Using Floating-Point Arithmetic in C Programming Language ?


Solution For C Program To Demonstrates Binary Expressions Using Floating-Point Arithmetic:
#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

Tags: C Program To Demonstrates Binary Expressions Using Floating-Point Arithmetic, arithmetic expression in c language, c program to evaluate arithmetic expression using stack, arithmetic expression evaluation using stack in c, days = days - 2 * 2, arithmetic expression in c++, evaluation of expressions in c, what is advantage of dynamic memory allocation, evaluation of arithmetic expression.


Learn More :