---
title: "What is Floyd’s triangle? Write a C# program to print a Floyd’s triangle."  
description: "What is Floyd’s triangle? Write a C# program to print a Floyd’s triangle."  
author: "Steilla Mitchel"  
published: 2021-11-23  
updated: 2021-11-23  
canonical: https://www.mindstick.com/forum/156861/what-is-floyd-s-triangle-write-a-c-sharp-program-to-print-a-floyd-s-triangle  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# 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](https://www.mindstick.com/forum/157407/javascript-program-to-print-all-prime-number-between-two-intervals) a Floyd’s triangle.

## Replies

### Reply by 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](https://www.mindstick.com/blog/301752/types-of-3d-printing-technology) in increment order. Follow is a [C# program](https://www.mindstick.com/forum/156830/how-do-i-make-a-c-sharp-program-that-checks-for-given-array-by-user-which-elements-are-perfect-numbers) 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');
  n=int.Parse(Console.ReadLine());
  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
```

\


---

Original Source: https://www.mindstick.com/forum/156861/what-is-floyd-s-triangle-write-a-c-sharp-program-to-print-a-floyd-s-triangle

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
