-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTableOfNumber.java
31 lines (24 loc) · 1.1 KB
/
TableOfNumber.java
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
/* Table of number inputed by user using multiple print statements and for loop. */
package problems;
import java.util.*;
class TableOfNumber {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter any number :");
int num = sc.nextInt();
sc.close();
// System.out.printf("%d * %d = %d \n", num, 1, num * 1);
// System.out.printf("%d * %d = %d \n", num, 2, num * 2);
// System.out.printf("%d * %d = %d \n", num, 3, num * 3);
// System.out.printf("%d * %d = %d \n", num, 4, num * 4);
// System.out.printf("%d * %d = %d \n", num, 5, num * 5);
// System.out.printf("%d * %d = %d \n", num, 6, num * 6);
// System.out.printf("%d * %d = %d \n", num, 7, num * 7);
// System.out.printf("%d * %d = %d \n", num, 8, num * 8);
// System.out.printf("%d * %d = %d \n", num, 9, num * 9);
// System.out.printf("%d * %d = %d \n", num, 10, num * 10);
for (int i = 1; i <= 10; i++) {
System.out.printf("%d * %d = %d \n", num, i, num * i);
}
}
}