A Program to print upside down triangle pattern with some fuzzy logic in C

A pattern program in C - language

Working example

/**
 *  5       5       5       5       5
 *      20      20      20      20
 *          60      60     60
 *              120     120
 *                  120
 */
#include <stdio.h>
int main()
{
    int start, end = 1, i, j, n, result;
    printf(" Enter starting value: ");
    scanf("%d", &start);
    result *= start;
    for (i = start; i >= end; i -= 1)
    {
        for (j = start; j > i; j -= 1)
        {
            printf("\t");
        }

        for (j = i; j >= end; j -= 1)
        {
            printf("\t %d \t", result);
        }
        result *= (i - 1);
        printf("\n");
    }
    printf("\n");
    return 0;
}
Avatar

A web geek, an industry experienced web developer & tutor/instructor residing in India 🇮🇳

Next
Previous

Related