Advertisement
xellscream

Untitled

Dec 11th, 2012
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.16 KB | None | 0 0
  1. using System;
  2.  
  3. class FirThree
  4. {
  5.     static void Main()
  6.     {
  7.         byte n, line, current, last;
  8.         int lenght, left, right;
  9.         n = byte.Parse(Console.ReadLine());
  10.         if ((n >= 4) && (n <= 100))
  11.         {
  12.             lenght = (2 * n) + 1;
  13.             for (line = 1; line <= n; line++)
  14.             {
  15.                 left = (n + 1) - line;
  16.                 right = (n - 1) + line;
  17.                 for (current = 0; current < lenght; current++)
  18.                 {
  19.                     if ((current >= left) && (current <= right))
  20.                     {
  21.                         Console.Write("*");
  22.                     }
  23.                     else
  24.                     {
  25.                         Console.Write(".");
  26.                     }
  27.                 }
  28.                 Console.WriteLine();
  29.             }
  30.             for (last = 0; last < lenght; last++)
  31.             {
  32.                 if (last == n)
  33.                 {
  34.                     Console.Write("*");
  35.                 }
  36.                 else
  37.                 {
  38.                     Console.Write(".");
  39.                 }
  40.             }
  41.             Console.WriteLine();
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement