-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtable.java
More file actions
32 lines (29 loc) · 695 Bytes
/
Copy pathtable.java
File metadata and controls
32 lines (29 loc) · 695 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
* Write a program to print the multiplication table of a number N,entered by the user.
*/
import java.util.Scanner;
public class table {
public static void main(String[] args) {
try (Scanner sc = new Scanner(System.in)) {
System.out.print("Enter the table numbere: ");
int table = sc.nextInt();
for (int i = 1; i <= 10; i++){
System.out.println(table + "*" + i + " = " + (table * i));
}
}
}
}
/*
* Output:
* Enter the table numbere: 5
* 5*1 = 5
* 5*2 = 10
* 5*3 = 15
* 5*4 = 20
* 5*5 = 25
* 5*6 = 30
* 5*7 = 35
* 5*8 = 40
* 5*9 = 45
* 5*10 = 50
*/