Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
x by stars
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.Scanner; class Rextester { public static void main(String args[]) { Scanner in=new Scanner(System.in); int n; n=in.nextInt(); for(int i=1;i<=n;i++) { for(int j=1;j<=i;j++) System.out.print(" "); for(int k=1;k<=i;k++) System.out.print("*"); for(int l=0;l<=(4*n)-(4*i);l++) System.out.print(" "); for(int m=1;m<=i;m++) System.out.print("*"); System.out.println(""); } for(int i=2;i<=n;i++) { for(int j=1;j<=n-i+1;j++) System.out.print(" "); for(int k=1;k<=n-i+1;k++) System.out.print("*"); for(int l=1;l<=4*(i-1);l++) System.out.print(" "); for(int m=1;m<=(n-i+1);m++) System.out.print("*"); System.out.println(""); } } }
run
|
edit
|
history
|
help
0
191fa07050
document
exp 3
Document management system - build unordered list (table of contents) recursively
piglatin
j
assign
1.5
Fibonacci numbers 0 - 94
linkl