C program for Reverse of Floyd’s triangle

C program for Reverse of Floyd’s triangle/number pattern 25

This program is to print Reverse of Floyd’s triangle number pattern 25 in C.

10  9  8   7

6    5   4

3    2

1

If you need a dry run of the program or any other query, then kindly leave a comment in the comment box or mail me, I would be more than happy to help you.

Program

#include<stdio.h>

void main()
{
    int i,j,n;

    printf("Enter the no of lines\n");
    scanf("%d",&n);

    printf("Reverse of Floyd's Triangle\n");
    int k = (n*(n+1))/2;
    for(i=n;i>=1;i--)
    {
        for(j=i;j>=1;j--,k--)
        {
            printf("%4d", k);   //4 spaces
        }

        printf("\n");
    }
}

Output

reverseFloydTriangle

Share Me!