Advertisement
braveheart1989

squareOfStars

Jan 24th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 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 squareOfStars
  8. {
  9.     class squareOfStars
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             for (int i = 0; i <(n); i++)
  15.             {
  16.                 string stars = new string('*', n);
  17.                 Console.WriteLine(stars);
  18.  
  19.                 for (int j = 0; j < n-2; j++)
  20.                 {
  21.                     stars = '*' + new string(' ', (n-2)) + '*';
  22.                     Console.WriteLine(stars);
  23.                 }
  24.                 stars = new string('*', n);
  25.                 Console.WriteLine(stars);
  26.                 break;
  27.             }
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement