Accept a number the display the table of that number in java

 Accept a number the display the table of that number in java

import java.util.Scanner;

public class DisplayTable
{
    public static void main(String args[]){
        int number;
        Scanner input=new Scanner(System.in);
        System.out.println("Enter a number ");
        number = input.nextInt();
        System.out.println("Table of "+number);
        for(int i=1;i<=10;i++){
        System.out.println(number+" x "+i+" = "+number*i);
        }
    }
}

Output
Enter a number 13 Table of 13 13 x 1 = 13 13 x 2 = 26 13 x 3 = 39 13 x 4 = 52 13 x 5 = 65 13 x 6 = 78 13 x 7 = 91 13 x 8 = 104 13 x 9 = 117 13 x 10 = 130

Comments

Popular posts from this blog

Make a GST Calculator using HTML and JavaScript

How to make simple bill maker by using python tkinter

Write a program to find the sum of 1/2+4/3+5/6+8/7+9/10 using loop in java