Following type of triangle is known as Floyd's triangle.
1
2 3
4 5 6
7 8 9 10
C Program to print Floyd's triangle
#include<stdio.h>
void main()
{
int i,j,temp,n;
clrscr();
temp=1;
printf("Enter the no. of rows : ");
scanf("%d",&n);
for(i=1;i<=5;i++)
{
for(j=i;j>=1;j--)
{
printf(" %d",temp);
temp++;
}
printf("\n");
}
getch();
}

nice example sir ..how to do the same using two variables or one for loop???thnks
ReplyDeleteClick to see the code!
To insert emoticon you must added at least one space before the code.