JAVA Question :P while ( startN <= endN ) { startN = startN++; System.out.println( +startN ); }
@bahrom7893
What are you trying to do?
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
apparently this is an infinite loop...i don't get it HOW??!?!
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 ); } }
well first of all, on this can be simplified down to this: while (startN <= endN) { System.out.println(startN ); startN++; }
hang on let me boot up eclipse..
LOL U HAVE THAT TOO?!?! SAME HERE XD
wait thats the same thing bahrom...
It is, only more readable..
lol yea i thought that would somehow fix this problem...
yea i was thinking of using a for loop but my teacher hasnt tought me that yet so i cant use it...
k i gtg, have fun
mhmm thanks for trying
Join our real-time social learning platform and learn together with your friends!