- 3
What is the output of following code
int count = 1; for(int i=0;i<=99;i++){ for(int i=0;i<=99;i++){ count++;}} cout<<count;
5 Answers
+ 9
There is a code playground for it Run it there
ans : 10001
starting count 1
iterations for one loop =100
for both loops = 100*100
total=10000+1 =10001
+ 6
Just lazy to run code?
The answer is 10001!
+ 3
Why not just run it and see for yourself? This website has the "Code Playground" that you can test from.
https://www.sololearn.com/Codes/
Anyways, basically you have 100 iterations in the first loop, and 100 for each one of those 100. So, 100 * 100 = 10000. Count started as 1, so it'd be 10001 I believe.
+ 2
2 nested loops of 100-> 100^2=10000
Add to initial value, 10000+1=10001.
Code ayground is here for a reason
+ 1
Thanks for one and all, who have posted the answer, from now I will try it on code playground, I doesn't knew about that, so thanks all of you