Skip to content

Instantly share code, notes, and snippets.

@KhaledElshamy
Created July 11, 2016 21:34
Show Gist options
  • Select an option

  • Save KhaledElshamy/1140f8aff4a6f158eb2be2eb97f60e34 to your computer and use it in GitHub Desktop.

Select an option

Save KhaledElshamy/1140f8aff4a6f158eb2be2eb97f60e34 to your computer and use it in GitHub Desktop.
URI ONLINE JUDGE 1435
#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