#include <stdio.h>int main(){ int star = 0, empty = 0; int num_empty = 0, num_star=0; int m = 5, n = 3; for (int i = 1; i < 2 * m; i++) { if (i <= m - n) { star = 2 * i - 1; empty = m - i; while (empty--) printf(" "); while (star--) printf("*"); } else if (m - n < i && i < m + n && j < 2 * n) { if (j <= n && i <= m) { num_empty = 2 * j - 1; empty = m - i; } else { num_empty = 2 * (2 * n - 1 - (j - 1)) - 1; empty = i - m; } num_star = star = m - n; while (empty--) printf(" "); while (star--) printf("*"); while (num_empty--) printf(" "); while (num_star--) printf("*"); j++; } else { star = 2 * (2 * m - 1 - (i - 1)) - 1; empty = (2 * m - 1 - star) / 2; while (empty--) printf(" "); while (star--) printf("*"); } printf("\n"); } return 0;}