The Reverse Floyd's Triangle Pattern prints numbers or characters in reverse order, starting with the largest at the top and decreasing as the rows progress. Basically, it is Floyd's triangle that starts with the largest number and ends with 1. In this article, we will learn how to print the Reverse Floyd's Pattern using both numbers and characters in C.

The largest number in Floyd's triangle is the number of characters in it. It can be calculated using the number of rows with the following formula:
max = n * (n + 1) / 2
Then it can be decremented after printing each character. Let's look at the code implementation:
#include <stdio.h>
int main() {
int n = 4;
int c = n * (n + 1) / 2;
// Outer loop to print rows
for (int i = n; i >= 1; i--) {
// Inner loop to print the numbers in each row
for (int j = 1; j <= i; j++)
printf("%d ", c--);
printf("\n");
}
return 0;
}
#include <stdio.h>
int main() {
int n = 4;
char c = n * (n + 1) / 2 + 'A';
// Outer loop to print rows
for (int i = n; i >= 1; i--) {
// Inner loop to print the numbers in each row
for (int j = 1; j <= i; j++)
printf("%c ", c--);
printf("\n");
}
return 0;
}
Output
1 | A
2 3 | B C
4 5 6 | D E F
7 8 9 10 | G H I JExplanation: In this method, the outer loop controls the rows in reverse, while the inner loop prints characters or numbers, decreasing with each row. After each row, a newline is added to maintain the reversed pyramid structure.