Asignment: #81 Counting Machine Revisted
Code
/// Name: Sean Harrison
/// Period: 7
/// Program name: CountingMachine
/// File Name: CountingMachine.java
/// Date Finished: 2/19/2016
import java.util.Scanner;
public class CountingMachineRe
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int Number1, Number2, Number3, n;
Number1 = 0;
n = 0;
System.out.println( "Type in a number, and I'll count from it up to second number, by increments of the third number. " );
System.out.print( "Number 1: " );
Number1 = keyboard.nextInt();
System.out.println( " Counting to Number 2: " );
Number2 = keyboard.nextInt();
System.out.println( " Counting by Number 3: " );
Number3 = keyboard.nextInt();
for ( n = Number1; n <= Number2; n = n + Number3 )
{
System.out.println( n + " " );
}
}
}
Picture of the output