repl.it
@Hariz_Hazril/

1 to 10 dot - 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
public class Main {
   public static void main(String[] args) {
      dotFigure();
   }
   public static void dotFigure() {
      for (int i = 1; i <= 10; i++) {
         for (int t = 1; t <= -1 * i + 11; t++) {
            System.out.print("*");
         }
         System.out.println();
      }
   }   
}

   /*
   line     dots     -1 * line   -1 * line + 5
   1        4        -1          4
   2        3        -2          3
   3        2        -3          2
   4        1        -4          1
   5        0        -5          0
   */
Fetching token
?