C program to print Floyd’s triangle

Program to print Floyd's Triangle

C program to print Floyd’s triangle

The Floyd’s Triangle is a right-angled triangle with an array of natural numbers. It starts from 1 and consecutively selects the next greater number in a sequential way.

#include <stdio.h>
#include<conio.h>
void main()
{
  int num, i,  a, x = 1;
  clrscr();
printf("\n\t\t\t...Welcome To EduNews.Tech... ");
  printf("\n\nEnter the number of rows to print the Floyd's triangle : ");
  scanf("%d", &num);
  for (i = 1; i <= num; i++)
  {
    for (a = 1; a <= i; a++)
    {
      printf("%d ",x);
      x++;
    }
    printf("\n");

  }
  printf("\n\n\n\t\t\tThankyou for Joining Us !");
    printf("\n\t\t\t!Regards EduNews !");
  
  getch();
}

Program Output:

floyd's triangle

I hope this post helps you to understand Floyd’s Triangle and its implementation in C programming language.

Keep coding 🙂

2 thoughts on “C program to print Floyd’s triangle”

Leave a Reply

Your email address will not be published. Required fields are marked *