TodorMitev

trapezoid

Dec 4th, 2011
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.33 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Task03
  7. {
  8.     class Task03
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             byte n = byte.Parse(Console.ReadLine());
  13.             int pad = 2 * n;
  14.             string [,] trapezoid = new string[(n+1),(n*2)];
  15.             for (int i = 0; i < trapezoid.GetLength(0); i++)
  16.             {
  17.                 for (int j = 0; j < trapezoid.GetLength(1); j++)
  18.                 {
  19.                     if (i == n)
  20.                     {
  21.                         trapezoid[i, j] = "*";
  22.                     }
  23.                     else if (i == 0 && j >= n)
  24.                     {
  25.                         trapezoid[i, j] = "*";
  26.                     }
  27.                     else
  28.                     {
  29.                         trapezoid[i, j] = ".";
  30.                         trapezoid[i, n - i] = "*";
  31.                         trapezoid[i, (2 * n)-1] = "*";
  32.                     }
  33.  
  34.                    
  35.                 }
  36.             }
  37.             for (int i = 0; i < trapezoid.GetLength(0); i++)
  38.             {
  39.                 for (int j = 0; j < trapezoid.GetLength(1); j++)
  40.                 {
  41.                     Console.Write(trapezoid[i, j]);
  42.                 }
  43.                 Console.WriteLine();
  44.             }
  45.         }
  46.     }
  47. }
  48.  
Advertisement
Add Comment
Please, Sign In to add comment