This is a C program which prints the Floyd's triangle with respect to the input given.
PROGRAM :
OUTPUT :
| Floyd's triangle |
PROGRAM :
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i, j, k = 1,n;
printf("Enter the range: ");
scanf("%d", &n);
printf("\nFLOYD'S TRIANGLE : \n");
for (i = 1; i <= n; i++)
{
for (j = 1; j <= i; j++, k++)
{
printf("%d\t", k);
}
printf("\n");
}
return 0;
}
OUTPUT :
| C Program to print Floyd's Triangle |
No comments:
Post a Comment