Question : for loop in java stack overflow
Answered by : helpless-hedgehog-olqns9se2ho1
for(counter=10;counter>=1;counter--){ System.out.println(counter); }
Source : https://stackoverflow.com/questions/5162845/help-with-understanding-java-for-loops | Last Update : Tue, 16 Jun 20
Question : while loop java stack overflow
Answered by : prajuk-nusbaum
public class Total{ public static void main(String[] args){ System.out.println("Enter an integer: "); Scanner entry = new Scanner(System.in); int input1 = entry.nextInt(); System.out.println("Enter another integer: "); int input2 = entry.nextInt(); int total = input1 + input2; while (input2 > 0){ System.out.println(total + "\nEnter another interger: "); total += entry.nextInt(); } }
}
Source : https://stackoverflow.com/questions/18038533/using-while-loop-in-java | Last Update : Tue, 01 Nov 22