• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Problem 8.IsoscelesTriangle JOHNYTHEWINNER  Apr 8th, 2015 (edited) 232 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. using System;
2.
3. public class IsoscelesTriangle
4. {
5.         public static void Main()
6.         {
7.                 char unicode = '\u00A9'; //We set the correct symbol
8.                 int a =1;  // We will use it for loop so we could print how many symbols we want
9.                 int b =5;  // We will use it for loop so we could print how many symbols we want
10.                 int c=0;  // We will use it for loop so we could print base of the triangle
11.
12.         {
13.         Console.WriteLine("      "+unicode); // This is the top of the triangle
14.         }
15.                 do
16.                 {
17.                 string space1 = new String(' ', b); // This is empty spaces left of the triangle
18.                 string space = new String(' ', a);  // This is empty spaces inside of the triangle
19.      Console.WriteLine(space1+unicode+space+unicode);  // This is each row
20.                 b=b-1; // Here we make one less spaces left of the triangle
21.                 a=a+2; // Here we make two more spaces inside of the triangle
22.
23.
24.                 }
25.                 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
26.                 do
27.                 { Console.Write(unicode); //Here we print base of triangle
28.                         c=c+1;
29.                 }
30.                 while (c!=13);  // Of course we need print 2 more "a" symbols so triangle be finished (one left and one right)
31.        }
32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Top