MuffinMonster

Class Task 62#

Nov 1st, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.84 KB | None | 0 0
  1. class Program
  2.     {
  3.         static void Draw(int num, int lel)
  4.         {
  5.             if (num > lel)
  6.             {
  7.                 for (int i = num; i > lel; i--)
  8.                 {
  9.                     Console.Write("*");
  10.                 }
  11.                 Console.WriteLine();
  12.                 Draw(num - 1, lel);
  13.             }
  14.             if (num < lel)
  15.             {
  16.                 for (int i = lel - num; i < lel; i++)
  17.                 {
  18.                     Console.Write("*");
  19.                 }
  20.                 Console.WriteLine();
  21.                 Draw(num + 1, lel);
  22.             }
  23.         }
  24.         static void DrawMain(int num)
  25.         {
  26.             Draw(num, 0);
  27.             Draw(2, num);
  28.         }
  29.         static void Main(string[] args)
  30.         {
  31.             DrawMain(5);
  32.             Console.ReadKey();
  33.         }
  34.     }
Add Comment
Please, Sign In to add comment