You are viewing a single comment's thread. Return to all comments →
void printPattern(int n) { int size = 2 * n - 1; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { int min = i < j ? i : j; min = min < size - i ? min : size - i - 1; min = min < size - j ? min : size - j - 1; printf("%d ", n - min); } printf("\n"); } } int main() { int n; scanf("%d", &n); printPattern(n); return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Printing Pattern Using Loops
You are viewing a single comment's thread. Return to all comments →