5,402 views
1 votes
1 votes
{

double b =5 & 3 && 4 || 6 | 6 ;

printf("%lf",b);

}

a.2.000000

b.1.0

c.1.000000

d.compilation error

1 Answer

2 votes
2 votes

double b =5 & 3 && 4 || 6 | 6 Breaking the expression

Precedence higher to lower --> & , | , && , ||

Evaluating expression steps:

5 & 3 && 4 || 6 | 6

1 && 4 || 6 | 6

1 && 4 || 6

1 || 6

1

Now 1 is typecasted to double Hence answer is C

Answer is not B because double type in C gives answer upto 6 correct digit after decimal point.

Related questions

2 votes
2 votes
1 answer
1
2 votes
2 votes
1 answer
3
saipriyab asked Nov 28, 2017
4,681 views
The output of the following programmain ( ){int a = 1, b = 2, c = 3;printf (“%d”, a+ = (a+ = 3, 5, a));}
1 votes
1 votes
1 answer
4