Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class IsoscelesTriangle
- {
- public static void Main()
- {
- char unicode = '\u00A9'; //We set the correct symbol
- int a =1; // We will use it for loop so we could print how many symbols we want
- int b =5; // We will use it for loop so we could print how many symbols we want
- int c=0; // We will use it for loop so we could print base of the triangle
- {
- Console.WriteLine(" "+unicode); // This is the top of the triangle
- }
- do
- {
- string space1 = new String(' ', b); // This is empty spaces left of the triangle
- string space = new String(' ', a); // This is empty spaces inside of the triangle
- Console.WriteLine(space1+unicode+space+unicode); // This is each row
- b=b-1; // Here we make one less spaces left of the triangle
- a=a+2; // Here we make two more spaces inside of the triangle
- }
- while (a!=11); // "a" can't be highr because value "b" will be negative. If you want bigger triangle you should change "a" and "b" together
- do
- { Console.Write(unicode); //Here we print base of triangle
- c=c+1;
- }
- while (c!=13); // Of course we need print 2 more "a" symbols so triangle be finished (one left and one right)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement