-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBirinciSoru.java
More file actions
49 lines (33 loc) · 909 Bytes
/
BirinciSoru.java
File metadata and controls
49 lines (33 loc) · 909 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
43
44
45
46
47
48
49
package projeler;
import java.util.Scanner;
public class BirinciSoru {
public static void main(String[] args) {
/*KLAVYEDEN GİRİLEN SAYI İLE SEKİL CİZME (TEK SAYI GİRİLECEK)
N=5 İSE;
*
*
* * * * *
*
* */
Scanner input = new Scanner(System.in);
System.out.print("sayiyi giriniz : ");
int n = input.nextInt();
for (int counter = 0; counter < n; counter++) {
for (int counter2 = 0; counter2 < n*2; counter2++) {
if (counter !=n/2) {
System.out.print(" ");
}
}
if (counter==n/2) {
System.out.print(" ");
for (int counter3 = 0; counter3 < n; counter3++) {
System.out.printf("* ");
}
System.out.println();
}
else {
System.out.println("*");
}
}
}
}