/*
Pattern : 

*--------*
**------**
***----***
****--****
**********


*/




import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        for(int i = 1 ; i<=n ; i++){
            
            // //x* ( x stars)
            for(int j = 1 ; j <= i ; j++  ){    //loop 1
                System.out.print("*");
            }
            
            //y- ( y dashes)
            for(int k = 1 ; k <= n-i  ; k++ ){      //loop 2
                System.out.print("-");
            }
            
            //y- ( y dashes)
            for(int l = 1 ; l <= n-i ; l++  ){      //loop 3
                System.out.print("-");
            }
            
            //x* ( x stars)
            for(int m = 1 ; m <= i  ; m++ ){     //loop 4
                System.out.print("*");
            }
            
            System.out.println();
        }
    }
}




Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: