Created
July 11, 2016 21:35
-
-
Save KhaledElshamy/e7ba0bfbad2ae6e537b0b1c293c0389b to your computer and use it in GitHub Desktop.
URI ONLINE JUDGE 1478
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(void) { | |
| // URI ONLINE JUDGE 1478 | |
| int x, n, i, j,k, y,a; | |
| for (;;) | |
| { | |
| scanf("%d", &n); | |
| if (n == 0)break; | |
| for (i = 1;i <= n;i++) | |
| { | |
| x = i; | |
| k = i; | |
| for (j = 1;j <= n;j++) | |
| { | |
| y = j; | |
| if (x > y) | |
| { | |
| printf("%3d ", k); | |
| k--; | |
| } | |
| else if (i == y) | |
| { | |
| a = 1; | |
| printf("%3d ", a); | |
| } | |
| else if (x < y) | |
| { | |
| a++; | |
| printf("%3d ", a); | |
| } | |
| } | |
| printf("\n"); | |
| } | |
| printf("\n"); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment