Assignment 81

code

///Name: Mutsu Osoegawa
///Period: 7
///Project Name: Counting Machine Revisited
///File Name: CountingMachineRevisited.java
///Date: 2/11/2016

import java.util.Scanner;
public class CountingMachineRevisited
{
    public static void main( String[] args )
    {
        Scanner keyboard = new Scanner(System.in);
        int countFrom, countTo, countBy, n;
        
        System.out.print( "Count from: " );
        countFrom = keyboard.nextInt();
        System.out.print( "Count to: " );
        countTo = keyboard.nextInt();
        System.out.print( "Count by: " );
        countBy = keyboard.nextInt();
        System.out.println();
        
        for ( n = countFrom; n <= countTo; n = n + countBy )
        {
            System.out.print( n + " " );
        }
        System.out.println();
    }
}