- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStarPattern.java
More file actions
Latest commit
40 lines (27 loc) · 683 Bytes
/
Copy pathStarPattern.java
File metadata and controls
40 lines (27 loc) · 683 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
33
34
35
36
37
38
39
40
importjava.util.Collections;
importjava.util.Scanner;
publicclassStarPattern {
publicstaticvoidmain(String[] args) {
System.out.println("Program to get a star Pattern for an input.\n---");
Scannersm = newScanner(System.in);
System.out.print("Enter an integer value: ");
intval = sm.nextInt();
if (val>10 || val<1) {
System.out.println("Out of limit");
end();
}
else {
for (inti = val; i > 0; i--) {
for (intj = i; j > 0; j--) {
System.out.print("*");
}
System.out.print("\n");
}
end();
}
}
privatestaticvoidend() {
System.out.println("---\nThe Program has ended.");
System.exit(0);
}
}