Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace _3.House
- {
- using System;
- public class House
- {
- public static void Main(string[] args)
- {
- checked
- {
- int numN = int.Parse(Console.ReadLine());
- int lenghtExtDotSeq;
- int lenghtIntDotSeq;
- for (int row = 0; row < numN; row++)
- {
- // Printing the Roof of House:
- if (row == 0)
- {
- string dotStr = new string('.', numN / 2);
- Console.WriteLine("{0}{1}{0}", dotStr, '*');
- }
- else if (row == numN / 2)
- {
- Console.WriteLine(new string('*', numN));
- }
- else if (row < numN / 2)
- {
- lenghtExtDotSeq = (numN / 2) - row;
- string externalDotSeq = new string('.', lenghtExtDotSeq);
- lenghtIntDotSeq = numN - (2 * lenghtExtDotSeq) - 2;
- string internalDotSeq = new string('.', lenghtIntDotSeq);
- Console.WriteLine("{0}{1}{2}{1}{0}", externalDotSeq, '*', internalDotSeq);
- }
- else if (row == numN - 1)
- {
- // Printing the Floor of House:
- lenghtExtDotSeq = numN / 4;
- string externalDotSeq = new string('.', lenghtExtDotSeq);
- lenghtIntDotSeq = numN - (2 * lenghtExtDotSeq) - 2;
- string intBottomSeq = new string('*', numN - (2 * lenghtExtDotSeq));
- Console.WriteLine("{0}{1}{0}", externalDotSeq, intBottomSeq);
- }
- else if (row > numN / 2 && row + 1 < numN)
- {
- lenghtExtDotSeq = numN / 4;
- string externalDotSeq = new string('.', lenghtExtDotSeq);
- lenghtIntDotSeq = numN - (2 * lenghtExtDotSeq) - 2;
- string internalDotSeq = new string('.', lenghtIntDotSeq);
- Console.WriteLine("{0}{1}{2}{1}{0}", externalDotSeq, '*', internalDotSeq);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement