The Floyd's Triangle.
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
for n=5;
#include<stdio.h>
#include<conio.h>
int main()
{
n,i,j,a=1;
printf("Enter the number of rows in the Triangle: \n\n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
printf("%d ",a);
a++;
}
printf("\n\n");
}
getch();
return 0;
}
No comments:
Post a Comment