# What is Floyd’s triangle? Write a C# program to print a Floyd’s triangle.

What is Floyd’s triangle? Write a C# program to print a Floyd’s triangle.

Last updated:11/23/2021 10:48:50 PM ##### Ashutosh Kumar Verma

Floyd’s triangle:

A Floyd’s triangle is a right angular array of natural numbers starts with 1. It start from top left corner with 1 and print in increment order. Follow is a C# program to print a Floyd’s triangle.

Program:

```using System;
public class Program
{
public static void Main()
{
int n=1;
for(int i=1;i<=5;i++)
{
for(int j=1;j<=i;j++)
{
Console.Write(n+' ');
n++;
}
Console.WriteLine(' ');
}
}
}
```

Output:

```1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
```

Taking input from user for number of row in triangle.

Program:

```using System;
public class Program
{
public static void Main()
{
int n,num=1;
Console.WriteLine('Enter the number of row in Floyd's triangle');
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
{
Console.Write(num+' ');
num++;
}
Console.WriteLine(' ');
}
}
}
```

Output:

```Enter the number of row in Floyd's triangle
5
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
```