+ 1
Why it's output to show 256?
Int n=2 ,m=2; While(m--) n*=n; Cout<<n;
10 Réponses
+ 3
May be the value of m will be 3
Output will be 256 because int n =2 ,m=3 in while loop you wrote m
While(m--) when first time loop will run it will be while(3--) here value will be decrease after that n*=n means n=2*2 (here n=2)
Now n=4 then loop will run again m will be 2 now then n*=n ,n=4*4, n=16 then again loop will run and now value of m will be 1 so again
n*=n , n=16*16=256 then m-- here m will be 0 so final answer 256 will print on screen
+ 3
Suparna Podder this is very helpful here u can learn pointers in detail
Click on this link
https://www.youtube.com/playlist?list=PLBlnK6fEyqRjoG6aJ4FvFU1tlXbjLBiOP
loop are easy first make simple loop code like print Numbers from 1 to 5 and see how many times it working then increase value and see how its working then use nested loop analyze it .
First do dry run in rough copy u will understood much better and write value after one by one .
+ 2
Include your code with this method
https://www.sololearn.com/post/75089/?ref=app
And also correct your code.. there are some syntax error.
+ 1
Suparna Podder take screen shot and post it your feed post share link here... You may miising something there.. May m=3, not 2.
+ 1
I actually facing problem some output questions like pointer function loop .
+ 1
Suparna Podder you can share that problems or make questions. Some one from community, who knows the answer will help you to clear your doubt.. So directly share your problems of those concepts...
But don't ask just output🤨
+ 1
Your formatting and indentation is not correct 🤔
0
Suparna Podder what is your expected output?
Are you sure output 256? Add proof?
Wrong output..
0
It's sololearn questions nd it's show to output 256 @jayakrisna
0
Thanks a lot its helps me more🗡️ Ulduz 🗡️