using System;
using System.Collections.Generic;
using System.Text;
namespace example1
{
class Program
{
static void Main(string[] args)
// to print right angled triangle
{
int a = 5;
for (int i = 1; i
<= 5; i++)
{
for (int
j = 1; j <= i; j++)
{
Console.Write(" *");
}
Console.WriteLine();
}
Console.ReadKey();
// to print triangle or a tree shape.
for (int i = 1; i
<= 6; i++)
{
for (int
k = 1; k <= 6 - i; k++)
{
Console.Write(" ");
}
for (int
k = 1; k <= i; k++)
{
Console.Write(" *");
}
Console.WriteLine();
}
Console.ReadLine();
}
}
}
No comments:
Post a Comment