Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class KabarrMokhak {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int n, i, j;
- boolean flag;
- while (sc.hasNext()) {
- n = sc.nextInt();
- for (i = 0; i <= 2 * n; i++) {
- flag = true;
- for (j = 0; j <= 2 * n; j++) {
- if (Math.abs(n - i) + Math.abs(n - j) > n - 1)
- System.out.print(' ');
- else {
- if (flag)
- System.out.print('*');
- else
- System.out.print(' ');
- flag = !flag;
- }
- }
- System.out.println();
- }
- }
- sc.close();
- }
- }
Add Comment
Please, Sign In to add comment