#include <stdio.h>
int main() {
int rows;
printf("Enter number of rows: ");
scanf("%d", &rows);
int maxWidth = 2 * rows - 1;
for (int i = 0; i < rows; i++) {
int numbers = 2 * i + 1;
int spaces = (maxWidth - numbers) / 2;
// print leading spaces
for (int s = 0; s < spaces; s++) {
printf(" ");
}
// print 0 and 1 pattern
for (int j = 0; j < numbers; j++) {
printf("%d", j % 2);
}
printf("\n");
}
return 0;
}