Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- class IsoscelesTriangleSix
- {
- static void Main()
- {
- Console.OutputEncoding = Encoding.Unicode;
- string unicode = '\u00A9'.ToString();
- int b = 0;
- // The halfTriangle list will be storing the upper half of our isosceles triangle
- List<string> halfTriangle = new List<string>();
- halfTriangle.Add(unicode);
- // calculates all strings necessary for one cathetus of the triangle
- // stores them in the halfTriangle list
- do
- {
- string space = new String(' ', b);
- string print = unicode + space + unicode;
- halfTriangle.Add(print);
- b = b + 1;
- } while (b != 6);
- // printing the upper half of the triangle
- for (int i = 0; i < halfTriangle.Count; i++)
- {
- Console.WriteLine(halfTriangle[i]);
- }
- // printing the lower half of the triangle
- for (int i = halfTriangle.Count - 2; i >= 0; i--)
- {
- Console.WriteLine(halfTriangle[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement