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

9. What is the output of following section of a program? int a[10] = {1,2,3,4,5,6,7,8,9,10}; int i = 0, s = 0; while(i<10){ cout<

OpenStudy (anonymous):

Something seems wrong, it doesnt compile for me...

OpenStudy (anonymous):

That seems like it would output what you want. Does it not?

OpenStudy (anonymous):

@ccumings88 it seems but, can you show it here http://ideone.com/?

OpenStudy (anonymous):

#include <iostream> using namespace std; int main() { int a[10] = {1,2,3,4,5,6,7,8,9,10}; int i = 0; while(i<10) { cout<<a[i]<<" "; i = i+2; } return 0; } I removed the variable 's' since it wasn't being used but that worked. for me. I think if you copy and paste from here it will mess up the " " portion. So you might have to retype that. ---- By the way are you just trying to print only odd numbers?

OpenStudy (anonymous):

Ah, i think it was the quotes i had got wrong before.

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!