You are viewing a single comment's thread. Return to all comments →
simple and easy answer
for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { int min = (i<j?i:j)<(size-i-1<size-j-1?size-i-1:size-j-1)?(i<j?i:j):(size-i-1<size-j-1?size-i-1:size-j-1); printf("%d ", n - min); } printf("\n");
takes the minimum out of i,j,size-i-1 and size-j-1, where size is 2n-1
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 →
simple and easy answer
takes the minimum out of i,j,size-i-1 and size-j-1, where size is 2n-1