C# Program to Print shapes
Program Statement:
Write a program using for loop which prints the following output on the screen.
Program Statement:
Write a program using for loop which prints the following output on the screen.
*
**
***
****
***
**
*
Solution:
Solution:
static void Main(string[] args)
{
for (int i = 0; i <= 3; i++)
{
for (int j = 0; j <= i; j++)
{
Console.Write("*");
}
Console.WriteLine();
}
for (int i = 3; i >0; i--)
{
for (int j = 0; j <= i-1; j++)
{
Console.Write("*");
}
Console.WriteLine();
}
Console.ReadLine();}
0 comments:
Post a Comment