Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Eggs
- {
- class Eggs
- {
- //egg Top
- public static void eggTop(int eggTopHeight)
- {
- int dotControl = eggTopHeight - 3;
- int j = 0;
- StringBuilder line = new StringBuilder("");
- for (int i = 0; i < (eggTopHeight / 2) + 1; i++)
- {
- if (i == eggTopHeight - 1)
- {
- break;
- }
- line.Append('.', eggTopHeight - j + 1);
- // first line of the top of the egg applied
- if (j == 0)
- {
- line.Append('*', eggTopHeight - 2);
- }
- else
- {
- line.Append('*');
- }
- //dots, which are inner for the egg, growing per 4 on the line starting
- //from n+1: n = 4; dots at first line = 5, etc.
- if (j != 0)
- {
- dotControl += 4;
- line.Append('.', dotControl);
- }
- line.Append('*');
- line.Append('.', eggTopHeight + 1 - j);
- string resultLine = line.ToString();
- Console.WriteLine(resultLine);
- line.Remove(0, resultLine.Length);
- j += 2;
- }
- }
- public static void eggMiddle(int middleHeight)
- {
- string dot = ".";
- string dIes = "#";
- string middleLine = ".*";
- for (int height = 0; height < 2; height++)
- {
- for (int width = 0; width < 3 * middleHeight - 3; width++)
- {
- if (width % 2 == 0)
- {
- middleLine += dot;
- }
- else
- {
- middleLine += dIes;
- }
- }
- middleLine += "*.";
- Console.WriteLine(middleLine);
- dot = "#";
- dIes = ".";
- middleLine = ".*";
- }
- }
- public static void eggBottom(int bottomHeight)
- {
- }
- static void Main(string[] args)
- {
- string num = Console.ReadLine();
- int n = Convert.ToInt32(num);
- //logical parts:
- eggTop(n);
- eggMiddle(n);
- eggBottom(n);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement