/******************************************************/ /* Introduction to Programming */ /* By Dr. ANTF */ /* www.antf.net */ /* Copyright 2015 */ /* */ /* C# 329 - Problem 28: Drawing Empty Triangle 1 */ /******************************************************/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DOS { class Program { static void Main(string[] args) { int n; Console.Write("Please enter a number: "); n = int.Parse(Console.ReadLine()); Console.WriteLine("\n"); //upper part Console.Write("*"); Console.Write("\n"); //middle part for (int i = 0; i < n - 2; i++) { Console.Write("*"); for (int j = 0; j < i; j++) Console.Write(" "); Console.Write("*"); Console.Write("\n"); } //lower part for (int i = 0; i < n; i++) Console.Write("*"); Console.ReadKey(); } } }