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
OBF-7
static
hextoepeen
vampires number Eckel B. Thinking in Java
How many Squares in Rectangle
exp5
ZonedDateTime testing
vsecodertest2
Nick-test
Inheritance