Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define SIZE 10
- //https://otvet.mail.ru/question/212693092
- int main(){
- int i,j,ii,jj,arr[SIZE][SIZE];//={1,2,3,4,5,6,7,3,9};
- for(i=0;i<SIZE;i++)//populate array
- for(j=0;j<SIZE;j++)
- arr[i][j]=rand()%100;
- for(i=0;i<SIZE;i++)//print array
- {
- for(j=0;j<SIZE;j++)
- printf("%d\t",arr[i][j]);
- printf("\n");
- }
- for(i=0;i<SIZE;i++)//search for equal array elements
- {
- for(j=0;j<SIZE;j++)
- {
- for(ii=0;ii<SIZE;ii++)
- {
- for(jj=0;jj<SIZE;jj++)
- {
- if(arr[i][j]==arr[ii][jj]&&(i!=ii||j!=jj))
- printf("\n\n%d positions [%d][%d] and [%d][%d]\n",
- arr[i][j],i,j,ii,jj),
- i=j=ii=jj=SIZE;
- }
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement