Math, asked by rockysingh2181881, 4 months ago

Please choose the right output from the given options for the following
program
int a=0;
a = 10 + 5 * 2 * 8/2 + 4;
printf("%d", a);​

Answers

Answered by mad210203
0

a = 54

Explanation:

Program is given below.

#include <stdio.h>

int main()

{

//Declaring variables

int a=0;

// This expression is evaluated according to the BODMAS rule.

// In this expression, first division is performed and then multiplication and finally addition.

a = 10 + 5 * 2 * 8/2 + 4;

/*

\Rightarrow a = 10 + 5 * 2 * 8/2 + 4 (Perform division)

\Rightarrow a = 10 + 5 * 2 * 4 + 4 (Perform multiplication)

\Rightarrow a = 10 + 40 + 4 (Perform addition)

\Rightarrow a = 54

*/

printf("The value of a: %d", a);

return 0;

}

Refer the attached image for output.

Therefore, the value of a is equal to 54.

Attachments:
Similar questions