Assignment # 81 and Counting Machine Revisited
Code
/// Name: Tommy Oyuntseren
/// Period: 7
/// Program Name: CountingMachineRevisited
/// File Name: CountingMachineRevisited.java
/// Date: 1/28/2016
import java.util.Scanner;
public class CountingMachineRevisited
{
public static void main(String[] args)
{
Scanner keyboard=new Scanner(System.in);
int n, start, end, by;
System.out.print("Count from: ");
start=keyboard.nextInt();
System.out.print("Count to: ");
end=keyboard.nextInt();
System.out.print("Count by: ");
by=keyboard.nextInt();
System.out.println();
for (n=start; n<=end; n=n+by)
{
System.out.print(n+ " ");
}
System.out.println();
}
}
Picture of the output