Make a new start with a new Thought!

NOTE :                // indicates comments.This wont get printed in the output.This is used for for documentation purpose. PROGRAM: #incl...

Floyd's triangle program

NOTE :
              
// indicates comments.This wont get printed in the output.This is used for for documentation purpose.

PROGRAM:

#include<conio.h>
#include<stdio.h>
void main()
{
  int i,j,l,m,n,k=1;
  clrscr();
  printf("Enter the number of rows\t:\t");
  scanf("%d",&n);
  for(i=0;i<n;i++)                               //printing rows
  {
   for(j=0;j<=i;j++) //prints the floyd numbers
   {
      printf("%d  ",k++);
   }
   printf("\n");        //next row
  }
 getch();
}

OUTPUT :

0 comments: