gabi11

Algorithms - 3. Recursive Drawing

Aug 31st, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace Recursion
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             var number = int.Parse(Console.ReadLine());
  11.  
  12.             Print(number);
  13.         }
  14.  
  15.         static void Print(int index)
  16.         {
  17.             if (index <= 0)
  18.             {
  19.                 return;
  20.             }
  21.  
  22.             Console.WriteLine(new string ('*', index));
  23.  
  24.             Print(index - 1);
  25.  
  26.             Console.WriteLine(new string('#', index));
  27.  
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment