#include<stdio.h>
void main()
{
int num,i,j,k=0;
printf("Enter number of lines=");
scanf("%d",&num);
printf("\nFloyd’s triangle\n");
for(i=1;i<=num;i++)
{
for(j=1;j<=i;j++)
{
k++;
printf("%d\t",k);
}
printf("\n");
}
}
void main()
{
int num,i,j,k=0;
printf("Enter number of lines=");
scanf("%d",&num);
printf("\nFloyd’s triangle\n");
for(i=1;i<=num;i++)
{
for(j=1;j<=i;j++)
{
k++;
printf("%d\t",k);
}
printf("\n");
}
}
No comments:
Post a Comment