100 Most Important C# Programs
66. Program to print the floyd’s triangle.
Code:
# include <stdio.h>
# include <conio.h>
main( )
{
int i,n,s,r k=1;
clrscr( );
printf(“enter a number of rows”);
scanf(“%d”,&n);
for(i=1;i<=n;i++)
{
for(s=1;s<=40-i;s++)
printf(“ ”);
for(j=1;j<=i;j++)
printf(“%3d”,k++);
printf(“\n”);
}
getch( );
}