Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Car
- {
- class Car
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- int width = 3 * n;
- int height = 3 * (n / 2) - 1;
- int roofBodyHeight = n / 2;
- int wheelsHeight = (n / 2) - 1;
- for (int i = 1; i <= height+1; i++)
- {
- if (i == 1)
- {
- Console.Write(new string('.', width - 2 * n));
- Console.Write(new string('*', n));
- Console.Write(new string('.', width - 2 * n));
- Console.WriteLine();
- }
- else if (i > 1 && i <= roofBodyHeight)
- {
- for (int j = 1, k = (width - 2 * n) - 1, m = n; j < roofBodyHeight ; j++, k--, m+=2)
- {
- Console.Write(new string('.', k));
- Console.Write(new string('*', 1));
- Console.Write(new string('.', m));
- Console.Write(new string('*', 1));
- Console.Write(new string('.', k));
- Console.WriteLine();
- i++;
- }
- }
- else if (i == roofBodyHeight+2)
- {
- Console.Write(new string('*', i-1));
- Console.Write(new string('.', (width - 2 * i)+2));
- Console.Write(new string('*', i-1));
- Console.WriteLine();
- }
- else if (i > roofBodyHeight+2 && i < roofBodyHeight*2+1)
- {
- Console.Write(new string('*', 1));
- Console.Write(new string('.', width - 2));
- Console.Write(new string('*', 1));
- Console.WriteLine();
- }
- else if (i == roofBodyHeight*2+1)
- {
- Console.WriteLine(new string('*', width));
- }
- else if (i > roofBodyHeight*2+1 && i < height+1)
- {
- Console.Write(new string('.', n / 2));
- Console.Write(new string('*', 1));
- Console.Write(new string('.', (n / 2) - 1));
- Console.Write(new string('*', 1));
- Console.Write(new string('.', n - 2));
- Console.Write(new string('*', 1));
- Console.Write(new string('.', (n / 2) - 1));
- Console.Write(new string('*', 1));
- Console.Write(new string('.', n / 2));
- Console.WriteLine();
- }
- else if (i == height+1)
- {
- Console.Write(new string('.', n/2));
- Console.Write(new string('*', n / 2 + 1));
- Console.Write(new string('.', width - ((2*(n/2)+1)+2*(n/2))-1));
- Console.Write(new string('*', n / 2 + 1));
- Console.Write(new string('.', n/2));
- Console.WriteLine();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment