[ create a new paste ] login | about

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

C, pasted on May 10:
#include <stdio.h>

#define row 10
#define col 10

int main(){

	int arr[row][col] = { 0 };

	int i, j;
	for(i = 0; i < row; ++i)
		for(j = 0; j < (col - i); ++j)
			arr[i][j] = j + 1;

	for(i = 0; i < row; ++i){
		printf("[ ");
		for(j = 0; j < col; ++j)
			printf("%i ", arr[i][j]);
		printf("]\n");
	}

	return 0;
}


Output:
1
2
3
4
5
6
7
8
9
10
[ 1 2 3 4 5 6 7 8 9 10 ]
[ 1 2 3 4 5 6 7 8 9 0 ]
[ 1 2 3 4 5 6 7 8 0 0 ]
[ 1 2 3 4 5 6 7 0 0 0 ]
[ 1 2 3 4 5 6 0 0 0 0 ]
[ 1 2 3 4 5 0 0 0 0 0 ]
[ 1 2 3 4 0 0 0 0 0 0 ]
[ 1 2 3 0 0 0 0 0 0 0 ]
[ 1 2 0 0 0 0 0 0 0 0 ]
[ 1 0 0 0 0 0 0 0 0 0 ]


Create a new paste based on this one


Comments: