Tuesday, 10 January 2012

Floyds Traingle

#include<stdio.h>
#include<conio.h>

void main()
{
    int i,j,n,a=1;
    clrscr();
    printf("Enter the number of row::\n");
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=i;j++)
        {
            printf("%d",a);
            a++;
        }
        printf("\n");
    }
    getch();
}


Output :
Enter the number of row::4

1
2 3
4 5 6
7 8 9 10

No comments:

Post a Comment