#include<stdio.h>
int main()
{
int i,j,n,k=1;
clrscr();
printf("Enter the number of rows of Floyd's triangle: ");
scanf("%d",&n);
printf("FLOYD'S TRIANGLE\n\n");
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++,k++)
printf(" %d",k);
printf("\n");
}
getch();
}
int main()
{
int i,j,n,k=1;
clrscr();
printf("Enter the number of rows of Floyd's triangle: ");
scanf("%d",&n);
printf("FLOYD'S TRIANGLE\n\n");
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++,k++)
printf(" %d",k);
printf("\n");
}
getch();
}
No comments:
Post a Comment