×

Java Programs

Java Practice

Java program to print multiplication table of given number

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

Java Most Popular & Searched Programs »





Comments and Discussions!

Load comments ↻





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