Assignemnt #106 Displaying Some Multiples

Code


     /// Name: JJ Deng
    /// Period: 6
    /// Program Name: Displaying Some Multiples
    /// File Name: DMulti.java
    /// Date Finished: 4/26/2016
  
       import java.util.Scanner;
       import java.util.InputMismatchException;
        
        public class DMulti
        {
        	public static void main( String[] args )
        	{
        		Scanner keyboard = new Scanner(System.in);
        		int num = 0;
        
        		try
        		{
        			System.out.print("Choose a number: ");
        			num = keyboard.nextInt();
        			System.out.println("");
        		}
        		catch (InputMismatchException e)
        		{
        			System.out.println("Try again");
        		}
        
        		for (int i = 1; i < 13; i++ )
        			System.out.println(num+"x"+i+" = "+ (num*i));
        
        	}
        }
                 


    

Picture of the output

Assignment 111