Floyd's Triangle in C - C program to display Floyd’s triangle



 c program to display floyd’s triangle

Learn C - C tutorial - c program to display floyd’s triangle - C examples - C programs

C program to display Floyd’s triangle

  • A right-angled triangular array of natural numbers is called Floyd triangle.
  • Building a Floyd's triangle in C is easy, but you must have the understanding of how for loop works.

Sample Code

#include<stdio.h>
int main()
{
    int i,j,r=8,k=1;
    printf("Number Range:8");
    printf("\n\nFLOYD'S TRIANGLE\n\n");
    for(i=1; i<=r; i++)
    {
        for(j=1; j<=i; j++,k++)
            printf(" %d",k);
        printf("\n");
    }
    return 0;
}

Output

Number Range:8

FLOYD'S TRIANGLE

 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


View More Quick Examples


Related Searches to Floyd's Triangle in C - C program to display Floyd’s triangle