C Program to Generate Floyd's Triangle
In this program, we generate Floyd's triangle using C programming language.
Program
#include<stdio.h>
int main()
{
int row, i, j, number=1;
printf("Enter number of rows: ");
scanf("%d", &row);
for(i=1; i<=row; i++)
{
for(j=1; j<=i; j++)
{
printf("%d\t", number);
number++;
}
printf("\n");
}
return 0;
}
Output of above program
Enter number of rows: 8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36