Computer Science, asked by mitha24, 9 months ago

Consider the following code and determine the value of a
1 int a
2*3/2*5/2&1;​

Answers

Answered by peeushpayodhi22391
23

Answer:

include<stdio.h>

int main()

{

int a[5] = {5, 1, 15, 20, 25};

int i, j, m;

i = ++a[1];

j = a[1]++;

m = a[i++];

printf("%d, %d, %d", i, j, m);

return 0;

Answered by blessedsoul096
1

Answer:

1

Explanation: We can write 2*3/2*5/2&1 as 2*(3/2)*(5/2)&1;

as BODMAS says division comes prior to multiplication.

Hence ,If we solve the expression 2 gets cancel out resulting in 3*(5/2)&1;

which further can be write as 15/2 & 1 .

So, in coding Arithmetic operator has higher precedence than bitwise operator .

Variable a should get int so ,15/2 gives 7 which is equal to (111)i.e binary code

1 1 1

0 0 1 (& operation)

-----------

0 0 1 =int 1

therefor int a=1;

Similar questions