Ask your own question, for FREE!
Mathematics 16 Online
OpenStudy (anonymous):

JAVA Question :P while ( startN <= endN ) { startN = startN++; System.out.println( +startN ); }

OpenStudy (anonymous):

@bahrom7893

OpenStudy (bahrom7893):

What are you trying to do?

OpenStudy (anonymous):

Write a program that asks the user for a starting value and an ending value and then writes all the integers (inclusive) between those two values. Enter Start: 5 Enter End: 9 5 6 7 8 9

OpenStudy (anonymous):

apparently this is an infinite loop...i don't get it HOW??!?!

OpenStudy (anonymous):

public void inclusiveIntegers() { int startN; int endN; System.out.println( "Enter Start: " ); startN = scan.nextInt(); System.out.println( "Enter End: " ); endN = scan.nextInt(); while ( startN <= endN ) { startN = startN++; System.out.println( +startN ); } }

OpenStudy (bahrom7893):

well first of all, on this can be simplified down to this: while (startN <= endN) { System.out.println(startN ); startN++; }

OpenStudy (bahrom7893):

hang on let me boot up eclipse..

OpenStudy (anonymous):

LOL U HAVE THAT TOO?!?! SAME HERE XD

OpenStudy (anonymous):

wait thats the same thing bahrom...

OpenStudy (bahrom7893):

It is, only more readable..

OpenStudy (anonymous):

lol yea i thought that would somehow fix this problem...

OpenStudy (bahrom7893):

have fun: http://pastebin.com/rpg1pmU9

OpenStudy (anonymous):

yea i was thinking of using a for loop but my teacher hasnt tought me that yet so i cant use it...

OpenStudy (bahrom7893):

Here's a while loop version: http://pastebin.com/f24KjNat

OpenStudy (bahrom7893):

k i gtg, have fun

OpenStudy (anonymous):

mhmm thanks for trying

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!