## C Program using a unique Math Formula

## Let’s walk through the c program in detail:

The standard input/output library is included in the c program’s opening “#include <stdio.h>” declaration, enabling it to use functions like “printf” for output display.

## Table of Contents

The program’s entry point is the ‘void main()’ function. It is customary in C Programs to use it to specify the main function, which is run upon program startup.

Several variables are declared and initialized inside the ‘main’ function. Integer variables ‘b,’ ‘c,’ ‘d,’ ‘e,’ and ‘i’ are defined and given certain values.

The variables ‘b,’ ‘c,’ ‘d,’ ‘e,’ and the constant ‘f’ are used in the computation on the next line. The assignment operator “=” is used to assign the calculation’s outcome to the variable “a.” ‘b + c * d + e * f’ is the computation.

The value of an is then shown using the “printf” function with the format specifier “%d,” which denotes an integer. Because the estimated value of “a” is 16, the output will read “a=16.”

The computation is repeated in the next line, using various operators and parentheses. It gives ‘a’ the outcome. ‘(b + c) / d + e * f’ is the formula.

### Here is a C Program example of a math formula

```
#include <stdio.h>
void main()
{
int b=4, c=4, d=2, e=4, i=2,a;
a=b+cd + e*f;
printf("a=%d",a);
a=(b+c)/d+ e*f;
printf("na=%d", a);
a= b+c/((d+e)*f);
printf("na=%d",a);
}
output:
a=16
a=14
a=4
```

The value of ‘a’ is shown using a different ‘printf’ function. Because the computed value of “a” is 14, the output will read “a=14.”

The final computation changes the value of ‘a’ by utilizing the variables ‘b,’ ‘c,’ ‘d,’ ‘e,’ and ‘f’. ‘b + c / ((d + e) * f)’ is the computation.

The value of ‘a’ is shown using the final ‘printf’ function. Given that ‘a’ has been computed to have a value of 4, the result will be “a=4”.

The c program ends when it reaches the conclusion of the “main” function, which happens after the last “printf” instruction.

### c program executes three computation

The c program executes three computations and uses the ‘printf’ function to display the results, which sums up its capabilities. Here is a list of the computations and their associated results:

- Calculation:
`a = b + c * d + e * f`

- Output: “a = 16”

- Calculation:
`a = (b + c) / d + e * f`

- Output: “a = 14”

- Calculation:
`a = b + c / ((d + e) * f)`

- Output: “a = 4”

The application shows how to do fundamental mathematical operations including addition, multiplication, and division. It also demonstrates how parenthesis may be used to regulate the sequence of operations in computations. Each computation sends the outcome to the variable “a,” which then uses the “printf” function to show it.

### FAQs

#### what is the output of the Math formula in the c program?

output:

a=16

a=14

a=4

#### Here the c program executes three computations

Calculation: `a = b + c * d + e * f`

Output: “a = 16”

Calculation: `a = (b + c) / d + e * f`

Output: “a = 14”

Calculation: `a = b + c / ((d + e) * f)`

Output: “a = 4”

Last updated on Wednesday - June 7th, 2023