-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPractice05_Loops.java
More file actions
107 lines (89 loc) · 2.21 KB
/
Practice05_Loops.java
File metadata and controls
107 lines (89 loc) · 2.21 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package com.company;
import java.util.Scanner;
public class Practice05_Loops {
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
// 1. Problem
// int n=0;
// for (int i=n; i<=5; i++){
// for (int j=0; j<i; j++){
// System.out.print("* ");
// }
// System.out.println(" ");
// }
int n = 0;
for (int i=n; i<6; i++){
for (int j=1; j<i; j++){
System.out.print("* ");
}
System.out.println(" ");
for (int k=5; k>i; k--){
System.out.print("1 ");
}
}
// 2. Problem
//
// System.out.println("Enter any Number to get sum");
// int n = sc.nextInt();
// int s = 0;
// int i = 1;
// while (i<n){
// s = s + 2*i;
// i++;
// }
// System.out.println(s);
// 3. Problem
//
// System.out.println("Enter the number of which you want a table");
// int n = sc.nextInt();
// for (int i=1; i<=10; i++){
// int c = i*n;
// System.out.println(c);
// }
// 4. Problem
//
// System.out.println("Multiplication table of 10 is");
// int n = 10;
// for (int i=10; i>=1; i--){
// System.out.printf("%d x %d = %d \n", n, i, n*i);
// }
// 5. Problem
//
// int n = 5;
// int i = 1;
// int f = 1;
// while (i<=n){
// f *= i;
// i++;
// }
// System.out.println(f);
// 6. Problem
//
// int i = 1;
// while (i<=5){
// System.out.println(i);
// i++;
// }
// 7. Problem
// a.
// int i = 1;
// while (true){
// System.out.println(i);
// }
// b.
// for (int u=1; true;){
// System.out.println(u);
// }
// 9. Problem
// int sum = 0;
// for (int i = 1; i<=10; i++){
// sum = sum + i*8;
// }
// System.out.println(sum);
// 11. Problem
//
// for (int i= 2; true;){
// System.out.println(i);
// }
}
}