Monday, 24 August 2015

Write A C Program to Print Floyd's Triangle

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

int main()
{
            int i,j,n,k;
            clrscr();

            printf("\n\n Enter  the number : ");
            scanf("%d",&n);

            for(i=1,k=1;i<=n;i++)
            {
                        for(j=1;j<=i;j++,k++)
                        {
                                    printf(" %d ",k);
                        }
                        printf("\n");
            }
            getch();

            return 0;
}


No comments:

Post a Comment