⭐⚡Beginner
Print Floyd's Pattern Triangle Pyramid
Print Floyd triangle
Floyd's Triangle is a right-angled triangle filled with consecutive natural numbers.
Program Code
floyds_triangle.c
C
1#include <stdio.h>23int main() {4 int rows, num = 1;5 6 printf("Enter number of rows: ");7 scanf("%d", &rows);8 9 for (int i = 1; i <= rows; i++) {10 for (int j = 1; j <= i; j++) {11 printf("%4d", num);12 num++;13 }14 printf("\n");15 }16 17 return 0;18}Output
Enter number of rows: 5
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
Related Examples
Want to Learn More?
Explore our comprehensive tutorials for in-depth explanations of C programming concepts.
Browse Tutorials