344 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

1.1k
views
1 answers
2 votes
srestha asked May 19, 2019
1,068 views
Consider the following $C$ implementation which when given $3$ numbers a,b,c as input, find the maximum of $3$ numbers $a,b,c.$int kickstart(int a,int b,int c) { if(B1) return a ... $I) and II)$ or $I) and IV)$
147
views
1 answers
0 votes
Rohit Chakraborty asked Jan 11
147 views
Can you please explain the whole working of the code
475
views
1 answers
0 votes
tishhaagrawal asked Dec 16, 2023
475 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, ... wrong, can anyone explain, please! I am providing a screenshot of their solution below -