-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTable.java
More file actions
29 lines (26 loc) · 782 Bytes
/
Table.java
File metadata and controls
29 lines (26 loc) · 782 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
import java.util.Scanner;
public class Table {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("Enter t:");
int t = s.nextInt();
while (t > 0) {
System.out.println("Enter n:");
int n = s.nextInt();
// for(int i=1;i<11;i++)
// System.out.println(n+" x "+ i +" = "+ n*i);
// USING WHILE LOOP:
// int i=1;
// while(i<11){
// System.out.println(n+" x "+ i +" = "+ n*i);
// i++;
// }
int i = 1;
do {
System.out.println(n + " x " + i + " = " + n * i);
i++;
} while (i < 11);
}
s.close();
}
}