Advertisement
braveheart1989

DressPattern

Apr 17th, 2016
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.22 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 _03.Task3
  8. {
  9.     class DressPattern
  10.     {
  11.         static void TopPartOfDress(int n)
  12.         {
  13.             int underscore;
  14.             int stars = 2;
  15.             underscore = (12 * n) / 3;
  16.             Console.WriteLine("{0}.{0}.{0}",new string('_',underscore));
  17.             for (int row = 0; row < 3*n-1; row++)
  18.             {
  19.                 if (underscore==2)
  20.                 {
  21.                     break;
  22.                 }
  23.                 underscore -= 2;
  24.                 Console.WriteLine("{0}.{1}.{0}.{1}.{0}", new string('_', underscore),new string('*', stars));
  25.                 stars += 3;
  26.             }
  27.             Console.WriteLine(".{0}..{0}.", new string('*', stars));
  28.         }
  29.  
  30.         static void MiddlePartOfDress(int n)
  31.         {
  32.             int dot = 3 * n;
  33.             int underscore;
  34.             underscore = (12 * n);
  35.             for (int i = 0; i < n; i++)
  36.             {
  37.                 Console.WriteLine(".{0}.", new string('*', underscore));
  38.             }
  39.             underscore = (12 * n + 2) - 2 * dot;
  40.             Console.WriteLine("{0}{1}{0}", new string('.', dot), new string('*', underscore));
  41.         }
  42.         static void BottomPartOfDress(int n)
  43.         {
  44.             int dot = 3 * n;
  45.             int underscore = 3 * n;
  46.             int letter =  (12 * n + 2) - 2 * underscore;
  47.             for (int i = 0; i < n; i++)
  48.             {
  49.                 Console.WriteLine("{0}{1}{0}", new string('_', underscore), new string('o', letter));
  50.             }
  51.             underscore = 3 * n;
  52.             int stars = (12 * n ) - 2 * underscore;
  53.             for (int i = 0; i < 3 * n; i++)
  54.             {
  55.                 Console.WriteLine("{0}.{1}.{0}", new string('_', underscore), new string('*', stars));
  56.                 underscore--;
  57.                 stars+=2;
  58.             }
  59.             Console.WriteLine(new string('.', 12 * n + 2));
  60.         }
  61.  
  62.         static void Main(string[] args)
  63.         {
  64.             int n = int.Parse(Console.ReadLine());
  65.             TopPartOfDress(n);
  66.             MiddlePartOfDress(n);
  67.             BottomPartOfDress(n);
  68.         }
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement