C Program to create Floyds triangle

Program

#include <stdio.h>
void main()
{
	int n, i, j, a = 1;
	printf("Floyds triangle\n");
	printf("Enter the number of rows to print\n");
	scanf("%d", &n);
	printf("Printing Floyds triangle\n");
	for (i = 1; i <= n; i++)
	{
		for (j = 1; j <= i; j++)
		{
			printf("%d ", a);
			a++;
		}
		printf("\n");
	}
}

Output

Floyds triangle
Enter the number of rows to print
6
Printing Floyds triangle
1 
2 3 
4 5 6 
7 8 9 10 
11 12 13 14 15 
16 17 18 19 20 21