Testeksamne, og andre ting
This commit is contained in:
21
Testeksamen/Draw.java
Normal file
21
Testeksamen/Draw.java
Normal file
@@ -0,0 +1,21 @@
|
||||
public class Draw{
|
||||
public static void main(String[] args) {
|
||||
figure(8);
|
||||
figure(4);
|
||||
figure(2);
|
||||
}
|
||||
|
||||
public static void figure(int n){
|
||||
for(int i = 0; i < n; i++) {
|
||||
for(int j = 0; j < i; j++) {
|
||||
System.out.print(" ");
|
||||
}
|
||||
for(int j = 0; j < (2 * n) - 1 - (i*2); j++){
|
||||
System.out.print("*");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user