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 FirTree
- {
- class FirTree
- {
- static void Main(string[] args)
- {
- byte height = byte.Parse(Console.ReadLine());
- char dot = '.';
- char star = '*';
- int points = (height*2) - 2;
- int starsCount = 1;
- int dotsCount = points - starsCount;
- for (int i = 1; i < height; i++)
- {
- for (int j = 0; j < dotsCount/2; j++)
- {
- Console.Write("{0}", dot);
- }
- for (int j = 0; j < starsCount; j++)
- {
- Console.Write("{0}", star);
- }
- for (int j = 0; j < dotsCount/2; j++)
- {
- Console.Write("{0}", dot);
- }
- starsCount += 2;
- dotsCount = points - starsCount;
- Console.WriteLine();
- }
- starsCount = 1;
- dotsCount = points - starsCount;
- for (int j = 0; j < dotsCount / 2; j++)
- {
- Console.Write("{0}", dot);
- }
- for (int j = 0; j < starsCount; j++)
- {
- Console.Write("{0}", star);
- }
- for (int j = 0; j < dotsCount / 2; j++)
- {
- Console.Write("{0}", dot);
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment