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;
} Related Articles
Deepen your understanding with these curated continuations.
Program 5 min read
Identify whether the number is Even or Odd in C-language
Learn how to check if a number is even or odd in C using the modulo operator. Includes a flowchart, logic explanation, and complete source code.
Vishnu
Program 5 min read
Sum of Series Between Two Numbers Using For Loop in C
Learn how to calculate the sum of a series between two integers in C using a for loop. Detailed tutorial with logic explanation and working code.
Vishnu
Program 5 min read
Calculate Factorial in C Using a For Loop
Learn how to calculate the factorial of an integer in C using a for loop. Includes a step-by-step algorithm and complete working code examples.
Vishnu