Untitled

mail@pastecode.io avatar
unknown
plain_text
10 days ago
423 B
0
Indexable
Never
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();
		}
    }
}
Leave a Comment