C Program-To-Print_Floyd's-Triangle
C Language

C Program to Print Floyd’s Triangle

Floyd’s Triangle-It is right angled triangle made by using natural numbers.It starts from 1 and goes on increasing consecutively in sequence.

In this C program we have to print Floyd’s triangle by taking length of rows as input from the user.



Input rows-5



2 3

4 5 6

7 8 9 10

11 12 13 14 15

Table of Contents:

  1. Concept
  2. Algorithm
  3. Program
  4. Output
  5. Resources

Before writing this C program, lets go through the concept we are gonna use in our program to create Floyd’s Triangle.

1. Concept

For creating Floyd’s Triangle we have to go through some steps given below:

  • first we have to take the input of number of rows upto which we have to create Floyd’s Triangle.
  • we will take an integer n=1 for consecutive number sequence.
  • There will be two for loops used in the program first for changing rows and second for printing consecutive numbers.
  • at the end of second loop we will print n and increase its value by 1.
  • In the last step we will use a print statement to change the row.

The concept of C programming you need to learn before writing the program is:-

1.For Loop

Kindly learn this topic and have a little knowledge about triangle formation with loops.

2. Algorithm

Here’s the algorithm of writing C program to print Floyd’s Triangle for the inputted number of rows by the user.

  1. START
  2. Initialize loop variables i=1 and j=1
  3. Take a number n=1 for printing consecutive numbers
  4. Take the input of number of rows from user.
  5. In the first loop we will give the condition upto number of rows.
  6. Second loop is used for printing the values in row.
  7. at the end of second loop print n and increase its value by 1.
  8. At the end of first loop print null value to change row(move to next line): printf(“\n”)
  9. STOP

3.C program for Floyd’s Triangle

After going through the algorithm now we will take a look on the code below.Take input from user and move on to the C program. .

#include <stdio.h>

#include <conio.h>
int main()


int i=1,j=1;

int n=1,rows;

printf("enter number of rows :");





printf("%d ", n );



return 0;



After writing the C program for Floyd’s Triangle,now check the output.As we have taken rows=5 from the user, you can take any number of rows.let’s check the output.


If you want to try the program on your own then please use the resources and files of this program and learn by practicing.

  1. Raw Code
  2. C program File

Similar Posts

One Comment

Comments are closed.