Learn java app
Program to Print Multiplication Table
◀ ▷ ▶ ♤ ♠ ♡ ♥ ♧ ♣ ⊙e
2020. 6. 22. 07:27
반응형
Program:
import java.util.Scanner;
class MultiplicationTable{
public static void main(String args[]){
int n, c;
System.out.println("Enter an integer to print it's multiplication table: ");
Scanner in = new Scanner(System.in);
n = in.nextInt();
System.out.println("Multiplication table of " + n);
for (c = 1; c <= 10; c++)
System.out.println(n + "*" + c + " = " + (n*c));
}
}
Output:
Enter an integer to print it's multiplication table: 9
Multiplication table of 9 is :-
9*1 = 9
9*2 = 18
9*3 = 27
9*4 = 36
9*5 = 45
9*6 = 54
9*7 = 63
9*8 = 72
9*9 = 81
9*10 = 90