Created
July 11, 2016 21:34
-
-
Save KhaledElshamy/1140f8aff4a6f158eb2be2eb97f60e34 to your computer and use it in GitHub Desktop.
URI ONLINE JUDGE 1435
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int main() { | |
| //URI ONLINE JUDGE 1435 | |
| int n, i, j, x, y; | |
| for (;;) | |
| { | |
| scanf("%d", &n); | |
| if (n == 0)break; | |
| for (i = 1;i <= n;++i) | |
| { | |
| for (j = 1;j <= n;++j) | |
| { | |
| x = i; | |
| y = j; | |
| if (x > n / 2) | |
| x = n - i + 1; | |
| if (y > n / 2) | |
| y = n - y + 1; | |
| printf("%3d ", (x > y ? y : x)); | |
| } | |
| printf("\n"); | |
| } | |
| printf("\n"); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment