#include <stdio.h>
// Define the structure Triangle
struct Triangle {
int height;
char inner_symbol;
};
// Function to print the inverted triangle
void print_inverted(struct Triangle inverted_triangle) {
int height = inverted_triangle.height;
char symbol = inverted_triangle.inner_symbol;
// Print the top line
for (int i = 0; i < 2 * height; i++) {
printf("_");
}
printf("\n");
// Print the inverted triangle
for (int i = 0; i < height; i++) {
// Print leading spaces
for (int j = 0; j < i; j++) {
printf(" ");
}
// Print the left side of the triangle
printf("\\");
// Print the inner symbols
for (int j = 0; j < 2 * (height - i - 1); j++) {
printf("%c", symbol);
}
// Print the right side of the triangle
printf("/\n");
}
}
int main()
{
struct Triangle my_triangle;
// Query the user for the desired inverted triangle height and symbol
printf("Inverted triangle's height?\n");
scanf("%d", &my_triangle.height);
printf("Inverted triangle's symbol?\n");
scanf(" %c", &my_triangle.inner_symbol);
// Call the print_inverted function
print_inverted(my_triangle);
return 0;
}