Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class HouseWithWindow
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- HouseTop(n);
- HouseRoof(n);
- HouseAndRoofBottom(n);
- HouseBase(n);
- HouseAndRoofBottom(n);
- }
- private static void HouseBase(int n)
- {
- int dots = n * 2 - 3;
- for (int i = 0; i < n / 4; i++)
- {
- Console.Write(new string('*', 1));
- Console.Write(new string('.', dots));
- Console.Write(new string('*', 1));
- Console.WriteLine();
- }
- dots = n / 2;
- int windowWidth = n - 3;
- for (int i = 0; i < n / 2; i++)
- {
- Console.Write(new string('*', 1));
- Console.Write(new string('.', dots));
- Console.Write(new string('*', windowWidth));
- Console.Write(new string('.', dots));
- Console.Write(new string('*', 1));
- Console.WriteLine();
- }
- dots = n * 2 - 3;
- for (int i = 0; i < n / 4; i++)
- {
- Console.Write(new string('*', 1));
- Console.Write(new string('.', dots));
- Console.Write(new string('*', 1));
- Console.WriteLine();
- }
- }
- private static void HouseAndRoofBottom(int n)
- {
- int stars = 2 * n - 1;
- Console.WriteLine(new string('*', stars));
- }
- private static void HouseRoof(int n)
- {
- int outerDots = n - 2;
- int innerDots = 1;
- for (int i = 0; i < n - 1; i++)
- {
- Console.Write(new string('.', outerDots));
- Console.Write(new string('*', 1));
- Console.Write(new string('.', innerDots));
- Console.Write(new string('*', 1));
- Console.Write(new string('.', outerDots));
- Console.WriteLine();
- outerDots--;
- innerDots += 2;
- }
- }
- private static void HouseTop(int n)
- {
- Console.Write(new string('.', n - 1));
- Console.Write(new string('*', 1));
- Console.Write(new string('.', n - 1));
- Console.WriteLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement