Program to evaluate the mathematical expressions in c language. You can use this program both error(compiler and runtime error) free programs just copy and paste the programs and save your time.

How to solve the following mathematical expressions in C language and result store in float type of variable.

**a+b-(c+d)*3%e+f/9)&**

**a%4-b/2+(c*d-5)/e**

###
**Result Store in float type of variable up to 6th decimal place**

--------Program Start --------

#include<conio.h>

#include<math.h>

void main()

{

int a,b,c,d,e,f;

float result;

a=8, b=4, c=2, d=1, e=5, f=20;

//evaluate the frist expression

result= a+b-(c+d)*3%e+f/9;

printf("The Result of Frist mathimatical Expression is: %f\n", result);

a=17, b=5, c=6, d=3, e=5;

//evaluate the second expression

result= a%6-b/2+(c*d-5)/e;

printf("And Result of Second mathimatical expression is: =%f\n",result);

getch();

}

--------Program End -------

#include<conio.h>

#include<math.h>

void main()

{

int a,b,c,d,e,f;

float result;

a=8, b=4, c=2, d=1, e=5, f=20;

//evaluate the frist expression

result= a+b-(c+d)*3%e+f/9;

printf("The Result of Frist mathimatical Expression is: %f\n", result);

a=17, b=5, c=6, d=3, e=5;

//evaluate the second expression

result= a%6-b/2+(c*d-5)/e;

printf("And Result of Second mathimatical expression is: =%f\n",result);

getch();

}

--------Program End -------

**Note:**- This program evaluates the mathematical expressions according to math rule of BDMAS so to check output is correct or not solve the on paper according to mathematical rule on BODMAS rule. I am sure to this program code is correct.

Output:

The Result of Frist mathematical Expression is: 5.222222

And Result of Second mathematical expression is: 5.100000

### Result Store in float type of variable up to 2nd decimal place

--------Program Start --------

#include<conio.h>

#include<math.h>

void main()

{

int a,b,c,d,e,f;

float result;

a=8, b=4, c=2, d=1, e=5, f=20;

//evaluate the frist expression

result= a+b-(c+d)*3%e+f/9;

printf("The Result of Frist mathimatical Expression is: %0.2f\n", result);

a=17, b=5, c=6, d=3, e=5;

//evaluate the second expression

result= a%6-b/2+(c*d-5)/e;

printf("And Result of Second mathimatical expression is: =%0.2f\n",result);

getch();

}

#include<conio.h>

#include<math.h>

void main()

{

int a,b,c,d,e,f;

float result;

a=8, b=4, c=2, d=1, e=5, f=20;

//evaluate the frist expression

result= a+b-(c+d)*3%e+f/9;

printf("The Result of Frist mathimatical Expression is: %0.2f\n", result);

a=17, b=5, c=6, d=3, e=5;

//evaluate the second expression

result= a%6-b/2+(c*d-5)/e;

printf("And Result of Second mathimatical expression is: =%0.2f\n",result);

getch();

}

Output:

The Result of Frist mathematical Expression is: 5.22

And Result of Second mathematical expression is: 5.10

Note: float type of variable store by default and maximum up to 6th decimal place if you can customize like "0.2f"

I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.

If any dought about this c programming code or input & output please comment below

If you have other question about c programming send an email by contacting us form are given on page right side.

Thank You!