F JAVA Program To Calculate Multiplication Table Of User Input Number | CodeTheta

JAVA Program To Calculate Multiplication Table Of User Input Number

August 04, 2016

Code :
import java.util.Scanner;
class Multiplication_table {
 public static void main (String args[])
 {
  int input,loopVariable;
  Scanner object=new Scanner(System.in);
  System.out.println("Enter a number to calculate it's multiplication table: ");
  input=object.nextInt();
  System.out.println("Result is: ");
  for (loopVariable=1; loopVariable<=10; loopVariable++)
  {
   System.out.println(input + "*" + loopVariable + "=" + (input*loopVariable));
  }
 }
}

Output :
Enter a number to calculate it's multiplication table:
6
Result is:
6*1=6
6*2=12
6*3=18
6*4=24
6*5=30
6*6=36
6*7=42
6*8=48
6*9=54
6*10=60

IDE Used To Test This Code : Dr Java

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Post a Comment