For loops #81 (More Handling)
Code
/// Name: Amir Salehi
/// Period: 7
/// Program Name: Counting Machine Revisit
/// File Name: CountingMachineRevisit.java
/// Date Finished: 2/8/2016
import java.util.Scanner;
public class CountingMachineRevisit
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
System.out.print( "Count from: " );
int f = keyboard.nextInt();
System.out.print( "Count to: " );
int t = keyboard.nextInt();
System.out.print( "Count by: " );
int b = keyboard.nextInt();
for ( int n = f; n <= t ; n = n+b )
{
System.out.print( n + " " );
}
}
}
Picture(s) of the output