Q:

Java program to print multiplication table of given number

belongs to collection: Java Most Popular & Searched Programs

0

Java program to print multiplication table of given number

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

This Java program will read an integer number and print its multiplication table.

package com.includehelp;

import java.util.Scanner;

/**
 * program to print multiplication table of given number
 * @author includehelp
 */
public class MultipicationTable {
    public static void main(String[] args) {
        Scanner sc  =   new Scanner(System.in);
        System.out.print("Enter Number  : ");
        int num =   sc.nextInt();
        
        for(int i=1;i<=10;i++){
            int result = num*i;
            System.out.println(num+"*"+i+" = "+result);
        }
    }
}

Output

Enter Number  : 4
4*1 = 4
4*2 = 8
4*3 = 12
4*4 = 16
4*5 = 20
4*6 = 24
4*7 = 28
4*8 = 32
4*9 = 36
4*10 = 40

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Java program for Bank Management System... >>
<< Java program to find out largest integer number am...