C# program to print Floyds Triangle
Program
using System;
namespace PrintFloydsTriangle
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Floyd's Triangle");
Console.Write("Enter the number of rows:\t");
int row = int.Parse(Console.ReadLine());
int i, j, value = 1;
for (i = 1; i <= row; i++)
{
for (j = 1; j <= i; j++)
{
Console.Write(value + " ");
value++;
}
Console.WriteLine();
}
}
}
}
Output
Floyd's Triangle
Enter the number of rows: 6
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21