Ask your own question, for FREE!
Computer Science 5 Online
OpenStudy (anonymous):

The following for-loop is an infinite loop. for (int j = 0; j < 1000; i++ ) is this true or false

OpenStudy (anonymous):

well, yes, unless that i there is a typo.

OpenStudy (anonymous):

it's false no because this loop will print 999 times , not infinite time no

OpenStudy (anonymous):

but it's i that increases, not j, right?

OpenStudy (anonymous):

umm not increase no cause it given limit no, when it is infinite j>1000 and j=1000

OpenStudy (anonymous):

oh...so that i is a typo then. for (int j = 0; j < 1000; i++ ) <--infinite for (int j = 0; j < 1000; j++ ) <--not infinite

OpenStudy (anonymous):

okay then The following for-loop is an infinite loop. for (int j = 0; j < 1000; i++ ) false no

OpenStudy (anonymous):

beacuse it is not infinite loop no

OpenStudy (anonymous):

(int j = 0; j < 1000; j++ ) is not an infinite loop. yup. look closely though... ^ <--this part here

OpenStudy (anonymous):

okay thanx :)

OpenStudy (anonymous):

you're welcome :) though you could just try to write a program and see if it works lol :P

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!