-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
140 lines (131 loc) · 3.2 KB
/
Main.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
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
import java.util.Scanner;
import java.lang.Math;
class Main {
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
// Question 1
System.out.println("How many rows would you like?");
int rows1 = input.nextInt();
System.out.println("How long would you like your rows?");
int columns1 = input.nextInt();
for (int i = 1; i <= rows1; i++)
{
for (int j = 1; j <= columns1; j++)
{
System.out.print("*");
}
System.out.println("");
}
// Question 2
System.out.println("How many rows would you like?");
int rows2 = input.nextInt();
for (int q = 1; q <= rows2; q++)
{
for (int w = 1; w <= q; w++)
{
System.out.print("*");
}
System.out.println("");
}
// Question 3
System.out.println("How many rows would you like?");
int rows3 = input.nextInt();
for (int a = 1; a <= rows3; a++)
{
for (int s = 1; s <= (rows3 - a); s++)
{
System.out.print(" ");
}
for (int d = 1; d <= a; d++)
{
System.out.print("*" + " ");
}
System.out.println("");
}
// Question 4
System.out.println("How many rows (top half) would you like?");
int rows4 = input.nextInt();
for (int z = 1; z <= rows4; z++)
{
for (int x = 1; x <= (rows4 - z); x++)
{
System.out.print(" ");
}
for (int c = 1; c <= z; c++)
{
System.out.print("*" + " ");
}
System.out.println("");
}
for (int v = 1; v <= (rows4 - 1); v++)
{
for (int b = 1; b <= v; b++)
{
System.out.print(" ");
}
for (int n = rows4; n >= (v + 1); n--)
{
System.out.print("*" + " ");
}
System.out.println("");
}
// Question 5
System.out.println("How many rows would you like?");
int rows5 = input.nextInt();
for (int p = 1; p <= rows5; p++)
{
for (int u = 1; u <= (rows5 - p); u++)
{
System.out.print("o");
}
for (int y = 1; y <= p; y++)
{
System.out.print("T");
}
for (int y = 2; y <= p; y++)
{
System.out.print("T");
}
for (int u = 1; u <= (rows5 - p); u++)
{
System.out.print("o");
}
System.out.println("");
}
// Question 6
System.out.println("How many rows would you like?");
int rows6 = input.nextInt();
for (int zz = 1; zz <= rows6; zz++)
{
for (int xx = 1; xx <= zz; xx++)
{
System.out.print((int)Math.pow(zz, 2) + " ");
}
System.out.println("");
}
// Question 7
System.out.println("How many rows would you like?");
int rows7 = input.nextInt();
for (int aa = 1; aa <= rows7; aa++)
{
for (int ss = 0; ss < 10; ss++)
{
System.out.print(aa + ss + " ");
}
System.out.println("");
}
// Question 8
System.out.println("What number would you like to start at?");
int rows8 = input.nextInt() + 1;
for (int qa = 1; qa <= (rows8); qa++)
{
for (int ws = 1; ws <= (rows8 - qa); ws++)
{
System.out.print(".");
}
System.out.print(rows8 - qa);
System.out.println("");
}
}
}