How many times "Hello, world" be printed in the below program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How many times "Hello, world" be printed in the below program?

#include<stdio.h> Int main() { int i=1024; for( ;i;i>>=1) printf ("Hello, world\n"); return 0; }

29th Aug 2019, 7:41 PM
Akash Khanpara
Akash Khanpara - avatar
12 Answers
+ 1
Int main() - bug;☺ After bitwise operation: 1. 1024/2=512; 2. 512/2=256; 3. 256/2=128; 4. 128/2=64; 5. 64/2=32; 6. 32/2=16; 7. 16/2=8; 8. 8/2=4; 9. 4/2=2; 10. 2/2=1; 11. 0b1>>1=0;
29th Aug 2019, 10:11 PM
Solo
Solo - avatar
+ 7
The Q&A isn't for creating quizzes, maybe you should check out the quiz factory 😉
29th Aug 2019, 8:16 PM
Oma
Oma - avatar
+ 6
I don't k know c or c++, but you could copy & paste the text in a code, and test it. 😐
29th Aug 2019, 7:48 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
+ 4
i don't think this is a problem that need to be solve by the community for you, as said by 💜 Alex Tusinean 🍇 run the code and you get your answer
29th Aug 2019, 8:01 PM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 1
I am discussing my question with you guys not an error... If you can't solve,then simply say I don't know.. or just don't answer my question.. that's it.. what makes you to think that much about this I don't know.. if you can than do it...
29th Aug 2019, 8:58 PM
Akash Khanpara
Akash Khanpara - avatar
+ 1
Not once, since you have a mistake in the code.☺
29th Aug 2019, 9:41 PM
Solo
Solo - avatar
+ 1
Akash Khanpara Right, right 😃 C++ is case sensitive!
29th Aug 2019, 10:01 PM
Solo
Solo - avatar
+ 1
Yup.. perfect.. Thanks..Vasiliy
29th Aug 2019, 10:12 PM
Akash Khanpara
Akash Khanpara - avatar
0
Nope.. wrong.. Vasiliy
29th Aug 2019, 9:41 PM
Akash Khanpara
Akash Khanpara - avatar
0
But it's c programming question.. Vasiliy
29th Aug 2019, 10:02 PM
Akash Khanpara
Akash Khanpara - avatar
0
Akash Khanpara Thank! Now I will remember for a long time that 1024 in binary notation is a unit with ten zeros!☺
29th Aug 2019, 10:34 PM
Solo
Solo - avatar
0
Right.. Vasiliy 🤗
30th Aug 2019, 4:32 AM
Akash Khanpara
Akash Khanpara - avatar