programming-examples/c/Pattern_Programs/Floyds triangle.c
2019-11-15 12:59:38 +01:00

22 lines
461 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*Floyd's triangle
Floyd's triangle is a right angled-triangle using the natural numbers. Examples of Floyds triangle:
Example
1
2 3
4 5 6
7 8 9 10
*/
#include<stdio.h>
void main()
{
int i,j,r,k=1;
printf("Enter the range: ");
scanf("%d",&r);
printf("FLOYD'S TRIANGLE\n\n");
for(i=1; i<=r; i++)
{
for(j=1; j<=i; j++,k++)
printf(" %d",k);
printf("\n");
}
}