Search This Blog

Tuesday, 10 October 2017

Floyd's triangle : C program

/* Floyd's triangle */

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

void main()
{
 int no,i,j,temp=1;
 clrscr();
 printf("\nEnter No : ");
 scanf("%d",&no);
 for(i=1;i<=no;i++)
 {
  for(j=1;j<=i;j++)
  {
   printf("%d ",temp);
   temp=temp+1;
  }
  printf("\n");
 }
 getch();
}

Output :

No comments:

Post a Comment