Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- class IsoscelesTriangle
- {
- static void Main()
- {
- Console.OutputEncoding = Encoding.UTF8;
- Console.WriteLine("Enter hight of the triangle : ");
- int Height = int.Parse(Console.ReadLine());
- string Symbol ="\u00A9";
- //PadLeft(Int32) : Returns a new string that right-aligns the characters in this instance
- //by padding them with spaces on the left, for a specified total length.
- Console.Write(Symbol.PadLeft(Height));//First row.
- Console.WriteLine();
- for (int i = 1; i < Height - 1; i++)//The rows between the first and the last one.
- {
- Console.Write(Symbol.PadLeft(Height - i));
- Console.Write(Symbol.PadLeft(i * 2));
- Console.WriteLine();
- }
- for (int i = 0; i < Height; i++)//Last row.
- {
- Console.Write(Symbol + " ");
- }
- Console.WriteLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement