Java multplication table

By | 12/11/2014

This program asks for a multiplicand number and shows the multiplication table of given number.

MultiplicationTable.java:

import java.util.Scanner;

public class MultiplicationTable {
 public void run()
 {
  Scanner reader = new Scanner(System.in);
		
  int multiplicand;
		
  System.out.print("Which multiplication table would you like to see? ");
  multiplicand=reader.nextInt();
  reader.close();
		
  for(int i=1;i<11;i++)
  {
   System.out.println(multiplicand+" * "+i+" = "+multiplicand*i);
  }

 }
 public static void main(String[] args)
 {
  MultiplicationTable program = new MultiplicationTable();
  program.run();
 }
}

Leave a Reply

Your email address will not be published. Required fields are marked *