Program #81

Code

   
    /// Name: Afaf Nabeeha
    /// Period: 7
    /// Program Name: Counting Machine Revisited
    /// File Name: Revisited.java
    /// Date Finished: 1/29/16 public class Revistited
    
        import java.util.Scanner;
        public class Revisited
        {
            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();
            }
        }
             
    

Picture of the output

Assignment 81