Skip to content

Commit 86fdad5

Browse files
Irani-LaptopIrani-Laptop
Irani-Laptop
authored and
Irani-Laptop
committed
first time
1 parent 4f2605a commit 86fdad5

File tree

6 files changed

+303
-0
lines changed

6 files changed

+303
-0
lines changed

P73/.classpath

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
4+
<attributes>
5+
<attribute name="module" value="true"/>
6+
</attributes>
7+
</classpathentry>
8+
<classpathentry kind="src" path="src"/>
9+
<classpathentry kind="output" path="bin"/>
10+
</classpath>

P73/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/

P73/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>P73</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
encoding//src/P73.java=UTF-8
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=11
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
11+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
13+
org.eclipse.jdt.core.compiler.release=enabled
14+
org.eclipse.jdt.core.compiler.source=11

P73/src/P73.java

Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
/**
2+
* P73 : چاپ ستاره های مربع و مثلث و اشکال هندسی با ستاره
3+
*
4+
* @author Gholamali Nejad Hajali Irani
5+
* @version 1.0
6+
* @since 2021/01/23
7+
* @Team gClassAcademy
8+
* @Website https://www.youtube.com/c/gClassAcademy
9+
*
10+
*/
11+
12+
import java.util.Scanner;
13+
14+
public class P73
15+
{
16+
public static void main(String[] args)
17+
{
18+
Scanner input=new Scanner (System.in);
19+
20+
System.out.println("Enter n:");
21+
int n=input.nextInt(); //عدد ورودی از کاربر
22+
23+
System.out.println();
24+
System.out.println("Fig. 1");
25+
for (int x=1;x<=n;x++)
26+
{
27+
for (int y=1;y<=n;y++)
28+
System.out.print("* ");
29+
System.out.println("");
30+
}
31+
32+
33+
System.out.println();
34+
System.out.println("Fig. 1.1");
35+
for (int x=1;x<=n;x++)
36+
{
37+
for (int y=1;y<=n;y++)
38+
if (x==1 || y==1 || x==n || y==n)
39+
System.out.print("* ");
40+
else
41+
System.out.print(" ");
42+
System.out.println("");
43+
}
44+
45+
46+
System.out.println();
47+
System.out.println("Fig. 1.2");
48+
for (int x=1;x<=n;x++)
49+
{
50+
for (int y=1;y<=n;y++)
51+
if (x==y)
52+
System.out.print("* ");
53+
else
54+
System.out.print(" ");
55+
System.out.println("");
56+
}
57+
58+
59+
System.out.println();
60+
System.out.println("Fig. 2");
61+
for (int x=1;x<=n;x++)
62+
{
63+
for (int y=1;y<=x;y++)
64+
System.out.print("* ");
65+
System.out.println("");
66+
}
67+
68+
69+
System.out.println();
70+
System.out.println("Fig. 3");
71+
for (int x=1;x<=n;x++)
72+
{
73+
for (int y=1;y<=x;y++)
74+
System.out.print(" ");
75+
for (int y=1;y<=x;y++)
76+
System.out.print("*");
77+
System.out.println("");
78+
}
79+
80+
81+
82+
System.out.println();
83+
System.out.println("Fig. 4");
84+
for (int x=1;x<=n;x++)
85+
{
86+
for (int y=1;y<=n-x;y++)
87+
System.out.print(" ");
88+
for (int y=1;y<=x;y++)
89+
System.out.print("*");
90+
System.out.println("");
91+
}
92+
93+
System.out.println();
94+
System.out.println("Fig. 5");
95+
for (int x=1;x<=n;x++)
96+
{
97+
for (int y=1;y<=n-x;y++)
98+
System.out.print(" ");
99+
for (int y=1;y<=x;y++)
100+
System.out.print(" *");
101+
System.out.println("");
102+
}
103+
104+
105+
System.out.println();
106+
System.out.println("Fig. 6");
107+
for (int x=1;x<=n;x++)
108+
{
109+
for (int y=1;y<=n-x;y++)
110+
System.out.print(" ");
111+
for (int y=1;y<=x;y++)
112+
System.out.print("*");
113+
for (int y=1;y<=x-1;y++)
114+
System.out.print("*");
115+
System.out.println("");
116+
}
117+
118+
System.out.println();
119+
System.out.println("Fig. 7");
120+
for (int x=1;x<=n;x++)
121+
{
122+
for (int y=1;y<=n-x;y++)
123+
System.out.print(" ");
124+
for (int y=1;y<=x;y++)
125+
System.out.print(" *");
126+
for (int y=1;y<=x-1;y++)
127+
System.out.print(" *");
128+
System.out.println("");
129+
}
130+
131+
132+
133+
System.out.println();
134+
System.out.println("Fig. 8");
135+
for (int x=1;x<=n;x++)
136+
{
137+
for (int y=1;y<=n-x;y++)
138+
System.out.print(" ");
139+
for (int y=1;y<=x;y++)
140+
System.out.print("*");
141+
for (int y=1;y<=x-1;y++)
142+
System.out.print("*");
143+
System.out.println("");
144+
}
145+
146+
147+
for (int x=1;x<=n;x++)
148+
{
149+
for (int y=1;y<x;y++)
150+
System.out.print(" ");
151+
for (int y=1;y<=n-x;y++)
152+
System.out.print("*");
153+
System.out.println("");
154+
}
155+
156+
157+
158+
for (int x=1;x<=n;x++)
159+
{
160+
for (int y=1;y<=n-x;y++)
161+
System.out.print("*");
162+
System.out.println("");
163+
}
164+
165+
166+
System.out.println();
167+
System.out.println("Fig. 9");
168+
for (int x=1;x<=n;x++)
169+
{
170+
for (int y=1;y<=n-x;y++)
171+
System.out.print(" ");
172+
for (int y=1;y<=x;y++)
173+
System.out.print("*");
174+
for (int y=1;y<=x-1;y++)
175+
System.out.print("*");
176+
System.out.println("");
177+
}
178+
179+
180+
for (int x=2;x<=n;x++)
181+
{
182+
for (int y=1;y<x;y++)
183+
System.out.print(" ");
184+
for (int y=1;y<=n-x+1;y++)
185+
System.out.print("*");
186+
187+
for (int y=1;y<=n-x;y++)
188+
System.out.print("*");
189+
190+
System.out.println("");
191+
}
192+
193+
194+
System.out.println();
195+
System.out.println("Fig. 10");
196+
for (int x=1;x<=n;x++)
197+
{
198+
for (int y=1;y<=x;y++)
199+
System.out.print("* ");
200+
System.out.println("");
201+
}
202+
203+
for (int x=1;x<=n;x++)
204+
{
205+
for (int y=1;y<=n-x;y++)
206+
System.out.print("* ");
207+
System.out.println("");
208+
}
209+
210+
System.out.println();
211+
System.out.println("Fig. 11");
212+
for (int x=1;x<=n;x++)
213+
{
214+
for (int y=1;y<=n-x;y++)
215+
System.out.print(" ");
216+
for (int y=1;y<=x;y++)
217+
System.out.print("*");
218+
System.out.println("");
219+
}
220+
for (int x=2;x<=n;x++)
221+
{
222+
for (int y=1;y<x;y++)
223+
System.out.print(" ");
224+
for (int y=1;y<=n-x+1;y++)
225+
System.out.print("*");
226+
227+
System.out.println("");
228+
}
229+
230+
231+
System.out.println();
232+
System.out.println("Fig. 12");
233+
for (int x=1;x<=n;x++)
234+
{
235+
for (int y=1;y<=n;y++)
236+
{
237+
for (int z=1;z<=n/2-x/2;z++)
238+
System.out.print(" ");
239+
240+
if (x==y)
241+
System.out.print("* ");
242+
else
243+
System.out.print(" ");
244+
}
245+
System.out.println("");
246+
}
247+
248+
249+
}// end of main
250+
}// end of class
251+
252+
253+
254+
255+
256+
257+
258+
259+

0 commit comments

Comments
 (0)