C# program to print below star triangle by entering no of lines
*
**
***
****
*****
Here's a C# program that prints a star triangle based on the number of lines entered by the user:
using System;
class Program
{
static void Main()
{
Console.Write("Enter the number of lines: ");
int numLines = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <= numLines; i++)
{
for (int j = 1; j <= i; j++)
{
Console.Write("*");
}
Console.WriteLine();
}
}
}
This program prompts the user to enter the number of lines, then it uses nested loops to print the appropriate number of stars on each line. The outer loop controls the number of lines, and the inner loop prints the stars for each line. Each line has a number of stars equal to the line number.