hi guys,
heres my code:
package com.fds.loops;
import java.util.Scanner;
//for loop that counts up according to entered number
public class ForLoop {
public static void main(String[] args) {
Scanner userInput = new Scanner(System.in);
System.out.println("Enter a number to start from:");
int startNumber = userInput.nextInt();
System.out.println("Enter a number to count to:");
int endNumber = userInput.nextInt();
if (endNumber > startNumber) {
System.out.println("Im not counting backwards for you!");
} else {
System.out.println("Enter number to count by...");
int countNumber = userInput.nextInt();
for (int x = startNumber,startNumber < endNumber,countNumber) {
}
}
}
}
is it possible to create a loop that counts the numbers the way im doing it...or should you use an array?
It looks like you're new here. If you want to get involved, click one of these buttons!