Run Code  | API  | Code Wall  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

New House Exam 11 April

using System;

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //int length = 7;
            int length = int.Parse(Console.ReadLine());
            
            int roof = (length /2 + 1);
            int roofCounter = 1;
            int dashCounter = length;
            
            //Console.WriteLine(roof);
            
            
            
            for (int i = 0; i < roof; i++)         
            {
                Console.Write(Dashes((dashCounter - 1)/2));
                Console.Write(Stars(roofCounter));
                Console.Write(Dashes((dashCounter - 1)/2));
                Console.WriteLine();
                
                roofCounter += 2;
                dashCounter -= 2;
                
            }
            
            for (int i = 0; i < length; i++)
                
            {
                Console.Write("|");
                Console.Write(Stars(length - 2));
                Console.Write("|");
                Console.WriteLine();                                        
                
            }
            
            
        }
        
        static string Stars(int n)
        {
            return new String('*', n);
        }
        
        static string Dashes(int n)
        {
            return new String('-', n);
        }

        static string Sticks(int n)
        {
            return new String('|', n);
        }
    }
}
 run  | edit  | history  | help 0