C# program to print below star triangle by entering no of lines
*****
****
***
**
*
Here's C# program that prints the inverted 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 = numLines; i >= 1; 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 inverted star triangle. The outer loop controls the number of lines, starting from the input number of lines and decrementing by 1 on each iteration. The inner loop prints the stars for each line, with the number of stars equal to the current line number.