repl.it
@Hariz_Hazril/

1 to 10 - Increase Then Decrease

Java

No description

fork
loading
Files
  • Main.java
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
public class Main {
	public static void main(String[] args) {
		naik();
		turun();
	}

	static void naik() {
		for (int i = 1; i <= 10; i++) {
			for (int r = 1; r <= i; r++) {
				System.out.print("*");
			}
			System.out.println();
		}
	}

	static void turun() {
		for (int d = 1; d <= 10; d++) {
			for (int s = 1; s <= -1 * d + 10; s++) {
				System.out.print("*");
			}
			System.out.println();
		}
	}
}
Fetching token
?