Headlines
Loading...
C Program to print Floyd’s triangle

C Program to print Floyd’s triangle

#include<stdio.h>

#include<conio.h>

void main()

{

int i,j,k=1,n;

clrscr();

printf("\nEnter the number of rows:");

scanf("%d",&n);

for(i=1;i<=n;i++)

{

for(j=1;j<=i;j++)

{

printf(" %d",k);

k++;

}

printf("\n");

}

getch();

}

 

/**************OUTPUT****************

 

Enter the number of rows:4

 1

 2 3

 4 5 6

 7 8 9 10                     */

 


*** PLEASE checkout the Best deals from for top sites like Amazon, Flipkart etc ***