Here's a C program to print a triangle pattern of numbers:
#include <stdio.h>
int main() {
int n, num = 1;
printf("Enter the number of rows: ");
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= i; j++) {
printf("%d ", num);
num++;
}
printf("\n");
}
return 0;
}
This program will create a triangle pattern of numbers based on the number of rows you input. It prints numbers in an ascending order, starting from 1 and incrementing for each row.
For example, if you input 4 for the number of rows, the program will generate the following triangle pattern:
1
2 3
4 5 6
7 8 9 10
You can adjust the number of rows by changing the value you enter when prompted.