Advertisement
braveheart1989

Пеперуда

Jun 10th, 2016
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _05.Пеперуда
  8. {
  9.     class Program
  10.     {
  11.         static void TopPartOfButterFly(int n)
  12.         {
  13.             int stars = n - 2;
  14.             int space=1;
  15.             int backslash;
  16.             int line= n - 2;
  17.             for (int i = 0; i < (n-2)/2; i++)
  18.             {
  19.                 Console.WriteLine("{0}\\{1}/{0}", new string('*', stars), new string(' ', space));
  20.                 Console.WriteLine("{0}\\{1}/{0}", new string('-', line), new string(' ', space));
  21.             }
  22.  
  23.  
  24.         }
  25.         static void MiddlePartOfButterFly(int n)
  26.         {
  27.             int stars = n - 2;
  28.             int space = n - 2;
  29.             Console.WriteLine("{0}\\{1}/{0}", new string('*', stars), new string(' ', 1));
  30.             Console.WriteLine("{0}@{0}", new string(' ', space+1), new string(' ', 1));
  31.             Console.WriteLine("{0}/{1}\\{0}", new string('*', stars), new string(' ', 1));
  32.         }
  33.  
  34.         static void BottomPartOfButterFly(int n)
  35.         {
  36.             int stars = n - 2;
  37.             int space = 1;
  38.             int line = n - 2;
  39.             for (int i = 0; i < (n - 2) / 2; i++)
  40.             {
  41.                 Console.WriteLine("{0}/{1}\\{0}", new string('-', line), new string(' ', space));
  42.                 Console.WriteLine("{0}/{1}\\{0}", new string('*', stars), new string(' ', space));
  43.             }
  44.         }
  45.         static void Main(string[] args)
  46.         {
  47.             int n = int.Parse(Console.ReadLine());
  48.             TopPartOfButterFly(n);
  49.             MiddlePartOfButterFly(n);
  50.             BottomPartOfButterFly(n);
  51.  
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement