230 views

1 Answer

2 votes
2 votes

$2^{24} = (1000000000000000000000000)_2$

if(!(n & 1))
printf("*");
n = n >> 1;

 

(n & 1) will not be true until $n = 1$

and statement under if will execute whenever (n & 1) is not true

hence * will be printed 24 times, until the $2^{24}$ becomes 1.

There are 24 zeros in n and each iteration result in 1 right shift and also print $*$ 

Related questions

0 votes
0 votes
1 answer
1
0 votes
0 votes
1 answer
2
tishhaagrawal asked Dec 16, 2023
355 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...
0 votes
0 votes
1 answer
4
jugnu1337 asked Oct 22, 2023
353 views
Suppose A is a 12 by 9 incidence matrix from a connected (but unknown) graph with 9 nodes and 12 edges. The diagonal entries of $A^{T}.A$give the number of edges into eac...