Home

A program to print the format - inverted row numbers triangle

C Programming Language 043

The following code shows how to write a program to print the following format.

4444
333
22
1

Program

#include <stdio.h>

void main()
{
    int i, j;
    {
        for (i = 4; i >= 1; i--)
        {
            for (j = 1; j <= i; j++)
            {
                printf("%d", i);
            }
            printf("\n");
        }
    }

    printf("\n");
}

Result

4444
333
22
1


Last Updated on

Next Post: GraphProtocol: TS2322 null assignment in Subgraph →

Comments