Advertisement
KlimentHristov

Figure.Trapezoid

Nov 11th, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. using System;
  2. class Trapezoid
  3. {
  4.     static void Main(string[] args)
  5.     {
  6.         int n = int.Parse(Console.ReadLine());
  7.            
  8.             Console.WriteLine("{0}{1}",new string('.', n),new string('*', n));
  9.  
  10.             int outputDots = n-1;
  11.             int stars = 1;
  12.             int innerDots = n-1;
  13.  
  14.             for (int i = 0; i < n - 1; i++)
  15.             {
  16.                 Console.Write(new string('.', outputDots));
  17.                 Console.Write(new string('*', stars));
  18.                 Console.Write(new string('.', innerDots));
  19.                 Console.Write(new string('*', stars));
  20.  
  21.                 outputDots--;
  22.                 innerDots++;
  23.  
  24.                 Console.WriteLine();
  25.             }
  26.             Console.WriteLine(new string('*', n * 2));
  27.         }  
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement