Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Week3
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- for (int row = 1; row <= n; row++)
- {
- char side = '/', middle = ' ';
- // if we are on first or last row - we put '*' on both sides(left and right) instead of '/'
- if (row == 1 || row == n)
- {
- side = '*';
- }
- //if we are on "middle" row we put '|' instead of ' '
- if (row == (n + 1) / 2)
- {
- middle = '|';
- }
- //set template for each row
- Console.WriteLine("*{0}*{1}*{0}*", new string(side, 2*n -2), new string(middle, n));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement