LiskoSlayer63

l_pyramid

Sep 14th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.80 KB | None | 0 0
  1. void    l_pyramid(int size)
  2. {
  3.     int y;
  4.     int x;
  5.  
  6.     y = 0;
  7.     srand(time(NULL));
  8.     while (y < size)
  9.     {
  10.         x = 0;
  11.         while (x < size * 2)
  12.         {
  13.             if (y == 0 && x == size)
  14.                 l_putchar('X');
  15.             else if (x == size - y && y <= size - size / 10)
  16.                 l_putchar('/');
  17.             else if (x == size + y && y <= size - size / 10)
  18.                 l_putchar('\\');
  19.             else if (x > size - y && x < size + y && y < size - size / 10 && rand() % size * y < y)
  20.                 l_putchar('o');
  21.             else if (x > size - y && x < size + y && y == size - size / 10)
  22.                 l_putchar('-');
  23.             else if ((x == size - size / 10 || x == size + size / 10) && y > size - size / 10 && y < size - 1)
  24.                 l_putchar('|');
  25.             else if (x > 0 && x < size * 2 && y == size - 1)
  26.                 l_putchar('^');
  27.             else
  28.                 l_putchar(' ');
  29.             x++;
  30.         }
  31.         l_putchar('\n');
  32.         y++;
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment