×

Java Programs

Java Practice

Java program to print table of an integer number

This program will read an integer number and print their table.

Print table of an Integer Number using Java program

//Java program to print table of an integer number
 
import java.util.Scanner;
 
public class PrintTable {
 
    public static void main(String args[]){
         
        int number;
        Scanner SC=new Scanner(System.in);
         
        //input integer number
        System.out.print("Enter an integer postive number: ");
        number=SC.nextInt();
         
        //print table
        System.out.println("Table of " + number + " is ");
        for(int loop=1; loop<=10; loop++){
            System.out.println(number*loop);
        }
    }
}

Output

    
    Enter an integer postive number: 5
    Table of 5 is 
    5
    10
    15
    20
    25
    30
    35
    40
    45
    50

Core Java Example Programs »



Related Programs



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.