Skip to content

pc004.c

Problem Statement

Pattern : 5 4 3 2 1 4 3 2 1 3 2 1 2 1 1 for n = 5

Metadata

Property Detail
Author Amit Dutta (amitdutta4255@gmail.com)
License MIT

Actions

Raw View on GitHub

💡 You can print or save this file by opening Raw and using your browser.

Source Code

#include <stdio.h>
int main()
{
    int i, j, k, n;
    printf("Enter n : ");
    scanf("%d", &n);
    for (i = n; i >= 1; i--)
    {
        for (j = 1; j <= i - 1; j++)
        {
            printf("\t");
        }
        for (k = i; k >= 1; k--)
        {
            printf("%d\t", k);
        }
        printf("\n");
    }
    return 0;
}