#include <stdio.h>
int main() {
int n;
printf("Enter the number of rows: ");
scanf("%d", &n);
for (int i = 0; i < n; i++) {
// Print leading spaces for triangle alignment
for (int j = 0; j < n - i - 1; j++) {
printf(" ");
}
int val = 1; // first value in the row
for (int j = 0; j <= i; j++) {
// Print the value only if it's even, else print space
if (val % 2 == 0)
printf("%4d", val);
else
printf(" "); // space to maintain alignment
// Calculate next value in row using Pascal's formula
val = val * (i - j) / (j + 1);
}
printf("\n");
}
return 0;
}