Advertisement
Guest User

Diamond

a guest
Mar 30th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1. public class Übung10 {
  2.     public static void main(String[] args) {
  3.         int h = 19;
  4.         int l = 1;
  5.         int s = h/2;
  6.         int help1;
  7.         int help2;
  8.         int count = 0;
  9.  
  10.         while (count <= h) {
  11.             help1=l;
  12.             help2=s;
  13.             while (help2 > 0) {
  14.                 System.out.print(" ");
  15.                 help2--;
  16.             }
  17.  
  18.             while (help1 > 0) {
  19.                 System.out.print("A");
  20.                 help1--;
  21.             }
  22.             if (count < h / 2) {
  23.                 l+=2;
  24.                 s--;
  25.                 count++;
  26.                 System.out.println();
  27.             } else {
  28.                 l-=2;
  29.                 s++;
  30.                 count++;
  31.                 System.out.println();
  32.             }
  33.  
  34.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement