/*
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
*/
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int lines, i, j, k=1;
printf("\n Enter the number of lines : ");
scanf("%d",&lines);
printf("\nFloyd's Triangle :\n");
for(i=1; i<=lines; i++)
{
for(j=1; j<=i; j++)
{
printf("%d ",k);
k++;
}
printf("\n");
}
getch();
}
Run:
Previous Next
No comments:
Post a Comment