Question

Floyd's triangle is a right-angled triangular array of natural numbers as shown below:

floyd triangle

Write a program to print the Floy'd triangle.

Source Code

#include <stdio.h>

int main()
{
    int i, j, k = 1;
    for (i = 1; i <= 5; i++)
    {
        for (j = 1; j <= i; j++)
        {
            printf("%d\t", k++);
        }
        printf("\n");
    }

    return 0;
}