Untitled

 avatar
unknown
plain_text
a year ago
423 B
2
Indexable
public class hardpattern {
    public static void main(String[] args) {
        int n = 5;
		for(int i=1; i<=n; i++){
		    for(int j=1; j<=n; j++){
		        if(i+j==n/2+2 || j-i == n/2 || i-j == n/2 || i+j == n+1 + n/2 ){
		            System.out.print("*");
		        }
		        else{
		            System.out.print(" ");
		        }
             
		    }
            System.out.println();
		}
    }
}
Editor is loading...
Leave a Comment