codescracker


java

Java Program to Print Table of Number



« Previous Program Next Program »


Print Table of Number

To print the table of a number in Java Programming, you have to ask to the user to enter any number and start multiplying that number from 1 to 10 and display the multiplication result at the time of multiplying on the output screen.

Java Programming Code to Print Table of Number

Following Java Program ask to the user to enter any number to find the table of that number, then display it on the screen:

/* Java Program Example - Print Table of Number */
		
import java.util.Scanner;

public class JavaProgram
{
    public static void main(String args[])
    {
        int num, i, tab;
        Scanner scan = new Scanner(System.in);
		
        System.out.print("Enter a Number : ");
        num = scan.nextInt();
		
        System.out.print("Table of " + num + " is\n");
        for(i=1; i<=10; i++)
        {
            tab = num*i;
            System.out.print(num + " * " + i + " = " + tab + "\n");
        }
    }
}

When the above Java Program is compile and executed, it will produce the following output:

Java Program print table of number

Same Program in Other Languages

You may also like to learn and practice the same program in other popular programming languages:


« Previous Program Next Program »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test