|
|
back to boardCan anybody help me please? What is wrong with my code? #include <stdio.h> #include<conio.h> main() { int x[100][100],a,i,j; scanf("%d",&a); for( i = 0 ; i < a ; i++ ) for( j = 0 ; j < a ; j++ ) scanf("%d",&x[i][j]); for( i = 0 ; i < a ; i++ ) for( j = 0 ; j <= i ; j++ ) printf("%d ",x[i-j][j]); for( i = a ; i < 2 * a - 1 ; i++ ) for( j = a - 1 ; j >= i - 3 ; j-- ) printf("%d ",x[j][i-j]); getch(); } Re: Can anybody help me please? What is wrong with my code? Maybe, in order to get full credit point from this task, you should delete the "getch()" ? I do not want to see your sorting algorithm... Re: Can anybody help me please? What is wrong with my code? #include <stdio.h> #include<conio.h> main() { int x[100][100],a,i,j; scanf("%d",&a); for( i = 0 ; i < a ; i++ ) for( j = 0 ; j < a ; j++ ) scanf("%d",&x[i][j]); for( i = 0 ; i < a ; i++ ) for( j = 0 ; j <= i ; j++ ) printf("%d ",x[i-j][j]); for( i = a ; i < 2 * a - 1 ; i++ ) for( j = a - 1 ; j >= i - (a-1) ; j-- ) printf("%d ",x[j][i-j]); } Here's the correct code |
|
|