Assignment #81 and Counting Machine Revisited
Code
/// Name: Ali Kurland
/// Period: 6
/// Program Name: Counting Machine Revisited
/// File Name: CountingMachine2.java
/// Date Finished: 10/24/2015
import java.util.Scanner;
public class CountingMachine2
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int a, z, x;
System.out.print( "Count from: " );
a = keyboard.nextInt();
System.out.print( "Count to: " );
z = keyboard.nextInt();
System.out.print( "Count by: " );
x = keyboard.nextInt();
System.out.println();
for ( int n = a ; n <= z ; n = n+x )
{
System.out.print( n + " " );
}
System.out.print( "\n" );
}
}
Picture of the output