Assignemnt #81: Counting Machine Revisited
Code
/// Name: Cassie
/// Period: 6
/// Program Name: Counting Machine Revisited
/// File Name: countingmachine2.java
/// Date Finished: 2/10/2016
import java.util.Scanner;
class countingmachine2
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int startingNum, endingNum, intervalNum;
System.out.print( "Count from : " );
startingNum = keyboard.nextInt();
System.out.print( "Count to : " );
endingNum = keyboard.nextInt();
System.out.print( "Count by : " );
intervalNum = keyboard.nextInt();
for ( int n = startingNum ; n <= endingNum ; n = n+intervalNum )
{
System.out.println( n );
}
}
}
Picture of the output