[ create a new paste ] login | about

Link: http://codepad.org/yR8mVq3d    [ raw code | output | fork ]

C, pasted on Dec 13:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
#define G 10
int main()
{
    int grid[G][G],c,x;
    for(c=0;c<5;++c)
    {
        for(x=0;x<5;++x)
        {
            if(c == x) grid[c][x] = 0;
            else if (c < x) grid[c][x] = 1;
            else grid[c][x] = -1;
            printf("%2d\t ",grid[c][x]);
        }
        printf("\n");
    }
    return 0;
}


Output:
1
2
3
4
5
 0	  1	  1	  1	  1	 
-1	  0	  1	  1	  1	 
-1	 -1	  0	  1	  1	 
-1	 -1	 -1	  0	  1	 
-1	 -1	 -1	 -1	  0	 


Create a new paste based on this one


Comments: