Advertisement
4valeri

Ace_of_Diamonds

Feb 17th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.55 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 Problem_3___Ace_of_Diamonds
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.  
  15.  
  16.             Console.WriteLine("{0}", new string('*', n));
  17.  
  18.             int rows = n - 2;
  19.             int first = (n - 3) / 2;
  20.             int first2 = (n - 1) / 2;
  21.             int first3 = 1;
  22.  
  23.             for (int i = 0; i < first2; i++)
  24.             {
  25.                 if (n == 3)
  26.                 {
  27.                     Console.WriteLine("*@*");
  28.                     continue;
  29.                 }
  30.                 Console.WriteLine("*{0}{1}{0}*",
  31.                     new string('-', first),
  32.                     new string('@', first3),
  33.                     new string('-', first));
  34.  
  35.                 first3 += 2;
  36.                 first--;
  37.  
  38.                 if (first <=0)
  39.                 {
  40.                     first = 0;
  41.                 }
  42.             }
  43.  
  44.             int second2 = 1;
  45.             int second = n - 4;
  46.             int secondRow = first2 - 1;
  47.  
  48.             for (int i = 0; i < secondRow; i++)
  49.             {
  50.                 Console.WriteLine("*{0}{1}{0}*",
  51.                     new string('-', second2),
  52.                     new string('@', second),
  53.                     new string('-', second2));
  54.  
  55.                 second2++;
  56.                 second -= 2;
  57.             }
  58.             Console.WriteLine("{0}", new string('*', n));
  59.  
  60.         }
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement