Advertisement
ivanov_ivan

SqareOfStars

Apr 2nd, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 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 HomeWorkCoding101
  8. {
  9.     class SqareOfStars
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             //First part
  14.             int N = int.Parse(Console.ReadLine());
  15.  
  16.             //Write the first row
  17.             string row = new string('*' , N);
  18.             Console.WriteLine(row);
  19.  
  20.             //Write inner rows
  21.             for(int times = 0; times < N - 2; times++)
  22.             {
  23.                 //string currentRow = "*" + new string(' ', N - 2) + "*";
  24.                 //Console.WriteLine(currentRow);
  25.  
  26.                 string spaces = new string(' ' , N - 2);
  27.                 Console.WriteLine("*{0}*" , spaces);
  28.             }
  29.  
  30.             //Write the first row again
  31.             Console.WriteLine(row);
  32.  
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement