Assignemnt #81 and Counting Machine Revisited
Code
import java.util.Scanner;
public class CountingMachineRevisited
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int a, b, c;
System.out.print( "Count from: " );
a = keyboard.nextInt();
System.out.print( "Count to : " );
b = keyboard.nextInt();
System.out.print( "Count by : " );
c = keyboard.nextInt();
for ( int x = a; x <= b; x = x+c )
{
System.out.print( x + " " );
}
System.out.print(" ");
}
}
Picture of the output