Advertisement
ivanov_ivan

SquareOfStars

Jan 24th, 2016
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace Test
  9. {
  10.     class SquareStars
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             int n = int.Parse(Console.ReadLine());
  15.  
  16.             string firstRow = new string('*' , n);
  17.             Console.WriteLine(firstRow);
  18.  
  19.             for(int i = 0; i < n- 2; i++)
  20.             {
  21.                 string row = "*" + new string(' ' , n - 2) + "*";
  22.                 Console.WriteLine(row);
  23.             }
  24.  
  25.             Console.WriteLine(firstRow);
  26.  
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement