I wrote a program to find the symmetric elements in an array. Please suggest your version. How do you do it?
https://code.sololearn.com/c5ysO0dri5Kd/#c #include <stdio.h> #include <stdlib.h> int main() { int m, n, count= 0; scanf("%d %d\n", &m, &n); int arr[100][100]; if(n!=2){ printf("ReEnter the values. N value should be 2 for pairs to occur."); exit(1); } for(int i=0; i<m; i++){ for(int j=0; j<n; j++){ scanf("%d", &arr[i][j]); } } for(int i=0; i<m; i++){ for(int j=0; j<n; j++){ a= arr[j][i]; b= arr[i][j]; if(arr[i][j]== a && arr[j][i]==b){ printf("(%d, %d)\n", arr[i][j.3], arr[i][1]); count++; } } } if(count==0) printf("No symmetric pairs in the array!"); return 0; } //Considering array of size mxn where n is always 2. I am stuck later this. Please provide your idea/ Algorithm