Advertisement
solidsnake

C#AsteriskShapesWithLoops(Triangles)

Apr 22nd, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1.         Console.Write("Enter a value for l: ");
  2.             String input = Console.ReadLine();
  3.             Console.Write("Enter a value for h: ");
  4.             String input2 = Console.ReadLine();
  5.             int h =  int.Parse(input);
  6.             int l = int.Parse(input2);
  7.             int space = h - 1;
  8.            
  9.             for (int i = 0; i < h; i++)
  10.             {
  11.                 //for (int j = space; j > 0; j--)
  12.                 for (int j = 0; j < space; j++)
  13.                 {
  14.                     Console.Write(" ");
  15.                 }
  16.                 for (int j = 0; j < i; j++)
  17.                 {
  18.                     Console.Write("*");
  19.                 }
  20.                 space--;
  21.                 Console.WriteLine();
  22.             }
  23.             Console.ReadKey();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement