You are viewing a single comment's thread. Return to all comments →
int min(int i, int j) { return i < j ? i : j; } int max(int i, int j) { return i > j ? i : j; } int main() {
int n; scanf("%d", &n); for(int i = 0; i<2*n-1; i++) { for(int j = 0; j<2*n-1; j++) { printf("%d ",n - (min(2*n-2,i+j) - max(i,j))); } printf("\n"); } return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Printing Pattern Using Loops
You are viewing a single comment's thread. Return to all comments →
int min(int i, int j) { return i < j ? i : j; } int max(int i, int j) { return i > j ? i : j; } int main() {
}