Java Program To Print Table - Java Program Example

Write Java Program To Print A Mathematics Table.   In This Post We Share A Java Program Code For Print A Mathematics Table,  When We Compile  This Program Compiler Ask To Enter  A Number  And Show A Table After Compile Program.


 Program Code


package com.androidpro.in;




import
java.util.*;

public class
Main {

   
public static void main(String args[])
    {
       
int n, c;
       
System.out.println("Enter an integer to print it's multiplication table");
       
Scanner in = new Scanner(System.in);
       
n = in.nextInt();
       
System.out.println("Multiplication table of "+n+" is :-");

        for
( c = 1 ; c <= 10 ; c++ )
            System.
out.println(n+"*"+c+" = "+(n*c));
    
}

}



Output

Enter an integer to print it's multiplication table
9
Multiplication table of 9 is :
9*1=9
9*2=18
9*3=27
9*4=36
9*5=45
9*6=54
9*7=63
9*8=72
9*9=81
9*10=90

Post a Comment

0 Comments