Floyd's triangle.
Floyd's triangle. From Wikipedia, the free encyclopedia. Floyd's triangle is a right-angled triangular array of natural numbers, used in computer science education. It is named after Robert Floyd. It is defined by filling the rows of the triangle with consecutive numbers, starting with a 1 in the top left corner:
Output:
#include<iostream>
#include <stdio.h>
int main()
{
int n, i, c, a = 1;
printf("Enter the number of rows of Floyd\'s triangle to print:\n");
scanf("%d", &n);
for (i = 1; i <= n; i++)
{
for (c = 1; c <= i; c++)
{
printf("%d ",a);
a++; }
printf("\n");
}
return 0;
}
Awesome Job .... Really Impressed
ReplyDelete