Advertisement
iliya87

03.DrawFigure

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