C Program to Print Floyd’s Triangle

Program to print floyd’s triangle in c; In this tutorial, i am going to show you how to print floyd’s triangle in c program.

C Program to Print Floyd’s Triangle

#include <stdio.h>
int main() 
{
  int Rows, i,  j, Number = 1;
  printf(" Please Enter the Number of Rows:  ");
  scanf("%d", &Rows);
	
  printf(" \n Printing FLOYD'S Triangle \n \n");
  for ( i = 1 ; i <= Rows; i++ ) 
    {
	for ( j = 1 ; j <= i; j++ ) 
         {
	   printf("%d ", Number);
	   Number++;
	 }
	printf("\n");
     }
  return 0;
}

The result of the above c program; is as follows:

Please Enter the Number of Rows:  5
Printing FLOYD'S Triangle 
 
1 
2 3 
4 5 6 
7 8 9 10 
11 12 13 14 15 

More C Programming Tutorials

Be First to Comment

Leave a Reply

Your email address will not be published.