You are viewing a single comment's thread. Return to all comments →
how do you see this solution
int max(int a, int b){ if(a < b) return b; return a; } int main(){ int n; scanf("%d", &n); int size = (2 * n) - 1; int A[size][size]; for(int i = 0; i < size; i++){ for(int j = 0; j < size; j++){ A[i][j] = max(max(n - i , n - j) , max(i - n + 2, j - n + 2)); } } for(int i = 0; i < size; i++){ for(int j = 0; j < size; j++){ printf("%d ", A[i][j]); } printf("\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 →
how do you see this solution