Vertical and Reverse Paramid in c# using loop.
code:
using System;
public class HelloWorld
{
public static void Main(string[] args)
{
for (int i = 1; i <= 5; i++)
{
for (int j = i; j <=5; j++)
{
Console.Write(" ");
}
for (int k = 1; k <= i; k++)
{
Console.Write("*");
}
for (int l = 2; l <= i; l++)
{
Console.Write("*");
}
Console.WriteLine();
}
}
}
code:
using System;
public class HelloWorld
{
public static void Main(string[] args)
{
for (int i = 1; i <=5; i++)
{
for (int j = 1; j <=i ; j++)
{
Console.Write(" ");
}
for (int k = i; k <=5 ; k++)
{
Console.Write("*");
}
for (int l = i; l <=4; l++)
{
Console.Write("*");
}
Console.WriteLine();
}
}
}
kasa hu
ReplyDelete