Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // http://bgcoder.com/Contests/3/CSharp-Fundamentals-2011-2012-Part-1-Test-Exam
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _03.Trapezoid
- {
- class Trapezoid
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int stars = n;
- int dots = n;
- int innerDots = n - 1;
- DrawLine(dots, stars);
- Console.WriteLine();
- dots = n - 1;
- for (int i = 0; i < n-1; i++)
- {
- stars = 1;
- Console.WriteLine("{0}{1}{2}{1}", new string ('.',dots), new string('*', stars),
- new string('.', innerDots));
- dots--;
- innerDots++;
- }
- stars = 2 * n;
- Console.WriteLine("{0}", new string('*', stars));
- }
- private static void DrawLine(int dots, int stars)
- {
- for (int i = 0; i <dots; i++)
- {
- Console.Write(".");
- }
- for (int i = 0; i <stars; i++)
- {
- Console.Write("*");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement