307 views
1 votes
1 votes

if X and Y denote  the no of 0,1 then the value of 2X + y is

1 Answer

1 votes
1 votes
i is a static variable, so it will be placed in static memory section and it will not get re-initialized every time.
At first i = 6, then i will keep on decrementing till i is not 0. According to the code printf() will be called whenever the if statement is correct, so printf will be called for 5 times. when i = 1, we check --i , then i = 0. so when i = 0 printf() will not be called.

for 5 times 1 will be printed and for 0 times  0 will be printed.
X = 0,Y=5
so 2x+y =5

Related questions

0 votes
0 votes
1 answer
3
0 votes
0 votes
1 answer
4
tishhaagrawal asked Dec 16, 2023
378 views
Below is my approach to solving this question, can anyone please explain if I am doing it the right way?Let X = #free slotssince, m =7 and n = 3So, $4 \leqslant x\leqsla...