C program to print Floyd's Triangle.

#include<stdio.h>
#include<conio.h>
void main()
{
 clrscr();
 int range, i, j, k=1;
 printf("Enter the range (upto how many line ?) : ");
 scanf("%d",&range);
 printf("\nFloyd's Triangle :\n");
 for(i=1; i<=range; i++)
 {
  for(j=1; j<=i; j++, k++)
  {
   printf("%d ",k);
  }
  printf("\n");
 }
 getch();
}
C program to print Floyd's Triangle. C program to print Floyd's Triangle. Reviewed by on December 22, 2019 Rating: 5

No comments:

Powered by Blogger.