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<
Nope... that's not the output this section of code is going to generate. But more important: what's your question?
is it C program?
The code is in C++ (note the "cout"-syntax)..
oh yeah.. sorry. i didn't see that. so he is asking for output of given code.
is it nested for loop or individual?
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..
Well, the output is wrong in either case...
yes you are right.
Join our real-time social learning platform and learn together with your friends!