Created
March 28, 2020 13:11
-
-
Save dalcon10028/81d1026b4fb98940635a4b6424f938f1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.*; | |
| public class Main { | |
| public static void main(String[] args) { | |
| Scanner sc = new Scanner(System.in); | |
| StringBuilder sb = new StringBuilder(); | |
| int n = sc.nextInt(); | |
| for(int i=0; i<n; i++){ | |
| if (n==1) { | |
| sb.append("*"); | |
| break; | |
| } | |
| for(int j=0; j<2; j++){ | |
| for(int k=0; k<n; k++){ | |
| if(j==0 && k%2==0 || j==1 && k%2==1) sb.append("*"); | |
| else sb.append(" "); | |
| } | |
| sb.append("\n"); | |
| } | |
| } | |
| System.out.print(sb); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment