### check 2d array error

Here is requirement, the array[4][4] can only be placed with number from 1-9 and all them need to form a pair.

ex: 1 1 2 2
3 3 4 4
5 5 6 6
7 7 8 8
but the number can only be used to make a pair which mean, if user input 1,1,1 or 1,1,1,1 will get error. If the user entered 2 number which not a pair also error.

error ex: 1 1 2 2
3 3 4 4
5 5 6 6
7 7 8 9

Here is the code,i have a rough mindset of how to make it only but using x4 for loop seems to get me error for some reason i haven't input while loop since i couldn't even settle the current problem so if there is any help with details codes and explanation will be very appreciate.
 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960`` ``````#include void main() { int num[4][4]; int x,y,row,col,N,n=0; printf("come\n"); for(row=0;row<4;row++) { for(col=0;col<4;col++) { scanf("%d",&num[row][col]); } } for(row=0;row<4;row++) { for(col=0;col<4;col++) { N=num[row][col]; for(x=0;x<4;x++) { for(y=0;y<4;y++) { } if(row==x && col==y) { break; } if(N == num[x][y]) { n++; } } } } if(n>2) { printf("Sorry but only one number per pair!"); } printf("\n\n\n"); for(row=0;row<1;row++) { for(col=0;col<4;col++) { printf("%d",num[row][col]); } printf("\n"); } }``````

Topic archived. No new replies allowed.