-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPset1Mario.java
More file actions
42 lines (29 loc) · 808 Bytes
/
Pset1Mario.java
File metadata and controls
42 lines (29 loc) · 808 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
41
42
/**
User: mbaize
Date: 7/1/14
Time: 1:36am
*/
import java.io.Console;
public class Pset1Mario {
public static void main(String[] varArgs) {
int rows;
do{
Console c = System.console();
System.out.print("How many rows high would you like the pyramid to be? (The number must be between 0 and 23, inclusive.) ");
rows = Integer.parseInt(System.console().readLine());
//rows = c.readLine("How many rows high would you like the pyramid to be? (The number must be between 0 and 23, inclusive.) ");
} while (rows < 0 || rows > 23);
for (int i = 0; i < rows; i++)
{
for (int j = (rows - (i + 1)); j > 0; j--)
{
System.out.print(" ");
}
for (int k = (i + 2); k > 0; k--)
{
System.out.print("#");
}
System.out.print("\n");
}
}
}