program:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class startriangle
{
static void Main(string[] args)
{
Console.WriteLine("Enter the value:");
int x = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <= x; i++)
{
for (int j = 1; j <= x - i; j++)
Console.Write(" ");
for (int k = 1; k <= i; k++)
Console.Write("*");
Console.WriteLine(" ");
}
Console.ReadLine();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class startriangle
{
static void Main(string[] args)
{
Console.WriteLine("Enter the value:");
int x = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <= x; i++)
{
for (int j = 1; j <= x - i; j++)
Console.Write(" ");
for (int k = 1; k <= i; k++)
Console.Write("*");
Console.WriteLine(" ");
}
Console.ReadLine();
}
}
}
output:
No comments:
Post a Comment