C Program to print first n natural numbers in a Right angled Triangle pattern
Program
#include<stdio.h>
void main()
{
int num, i, j, count = 1;
printf("Enter the number of rows to be printed:\t");
scanf("%d", &num);
for (i = 1; i < num; i++)
{
for (j = 0; j < i; j++)
{
printf("%d\t", count);
count++;
}
printf("\n");
}
}
Output
Enter the number of rows to be printed: 5
1
2 3
4 5 6
7 8 9 10