Ask your own question, for FREE!
Computer Science 20 Online
OpenStudy (maram):

11. What is the output of the following section of a program? int a[8] = {2, 5, 1, 0, 0, 0, 0, 0}; for(int i=7;i>0;i--) a[i]=a[i -1]; for(int k=0;k<8;k++) cout<

OpenStudy (anonymous):

Nope... that's not the output this section of code is going to generate. But more important: what's your question?

OpenStudy (shayaan_mustafa):

is it C program?

OpenStudy (anonymous):

The code is in C++ (note the "cout"-syntax)..

OpenStudy (shayaan_mustafa):

oh yeah.. sorry. i didn't see that. so he is asking for output of given code.

OpenStudy (shayaan_mustafa):

is it nested for loop or individual?

OpenStudy (anonymous):

I think, he just copy&pasted some problem, he has to solve as homework.. But just posting the result won't help him much... I assumed , the loops are nested - otherwise the intendation of the second loop makes no sense, but yeah.. the { } are missing, so I could be mistaken..

OpenStudy (anonymous):

Well, the output is wrong in either case...

OpenStudy (shayaan_mustafa):

yes you are right.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!