Skip to content

Instantly share code, notes, and snippets.

@dalcon10028
Created March 16, 2020 11:16
Show Gist options
  • Select an option

  • Save dalcon10028/5f7d91c152189ca1913d93f995a3a9b2 to your computer and use it in GitHub Desktop.

Select an option

Save dalcon10028/5f7d91c152189ca1913d93f995a3a9b2 to your computer and use it in GitHub Desktop.
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i=1; i<=2*n-1; i++){
if (i<=n){
for(int j=0; j<i; j++)
System.out.print("*");
System.out.println();
}else{
for(int j=0; j<2*n-i; j++)
System.out.print("*");
System.out.println();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment