-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLooping.java
More file actions
52 lines (45 loc) · 1.08 KB
/
Looping.java
File metadata and controls
52 lines (45 loc) · 1.08 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import java.util.*;
public class Looping{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Print 1 to 10 Number: with for loop:
// for(int i = 0; i < 11; i++){
// System.out.println(i);
// }
// Print 1 to 10 Number: with while loop:
// int i = 0;
// while(i < 11){
// System.out.println(i);
// i++;
// }
// Print 1 to 10 Number: with d0-while loop:
// int i = 0;
// do{
// System.out.println(i);
// i++;
// }
// while(i < 11);
// int i = 12;
// while(i < 11){
// System.out.println(i);
// i++;
// }
// do{
// System.out.println(i);
// i++;
// }while (i < 11);
// Print the sum of First n Natural Number:
// System.out.println("Enter a Number:");
// int n = sc.nextInt();
// int sum = 0;
// for(int i = 1; i <= n; i++){
// sum = sum + i;
// }
// System.out.println(sum);
// Print the Table and input Number from the user:
int n = sc.nextInt();
for(int i = 1; i <= 10; i++){
System.out.println(n+" * "+i+" = "+(n*i));
}
}
}