How to find duplicate values in 3×3 matrix in c? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

How to find duplicate values in 3×3 matrix in c?

14th Oct 2018, 9:02 AM
Amruta
Amruta - avatar
17 Answers
+ 7
RAMALINGAM R now its perfect !! Thanks alot for helping 😊
14th Oct 2018, 2:35 PM
Amruta
Amruta - avatar
+ 7
RAMALINGAM R yes its working but its showing repeating values twice
14th Oct 2018, 2:38 PM
Amruta
Amruta - avatar
+ 6
RAMALINGAM R It shows all values and also shows duplicate values twice..
14th Oct 2018, 2:21 PM
Amruta
Amruta - avatar
+ 5
consider X as your array then for (i=0;i<3,i++) { for (j=0;j<3;j++) { for (k=0;k<3;k++) { for (l=0;l<3;l++) { if(X[i][j]==X[k][l]) { printf(X[i][j]\n); } } } } } //this will print repeated values in an 3X3 array
14th Oct 2018, 2:02 PM
RAMALINGAM R
RAMALINGAM R - avatar
+ 3
RAMALINGAM R yes you are right ..
14th Oct 2018, 2:54 PM
Amruta
Amruta - avatar
+ 2
then add this line to add exception if (i==k && j==l) { continue; }
14th Oct 2018, 2:28 PM
RAMALINGAM R
RAMALINGAM R - avatar
+ 2
s because two times it satisfies the condition eg: X23=X15 X15=X23
14th Oct 2018, 2:43 PM
RAMALINGAM R
RAMALINGAM R - avatar
+ 2
RAMALINGAM R Now its perfect !! 👍
14th Oct 2018, 2:55 PM
Amruta
Amruta - avatar
+ 2
Thanks for helping 😊
14th Oct 2018, 2:55 PM
Amruta
Amruta - avatar
+ 1
use 4 loops
14th Oct 2018, 1:49 PM
RAMALINGAM R
RAMALINGAM R - avatar
+ 1
before the if condition
14th Oct 2018, 2:29 PM
RAMALINGAM R
RAMALINGAM R - avatar
+ 1
is it working??
14th Oct 2018, 2:36 PM
RAMALINGAM R
RAMALINGAM R - avatar
+ 1
then add a brea; command after printf
14th Oct 2018, 2:45 PM
RAMALINGAM R
RAMALINGAM R - avatar
+ 1
break;
14th Oct 2018, 2:45 PM
RAMALINGAM R
RAMALINGAM R - avatar
+ 1
ok
14th Oct 2018, 2:56 PM
RAMALINGAM R
RAMALINGAM R - avatar
0
X12=X22 X22=X12
14th Oct 2018, 2:43 PM
RAMALINGAM R
RAMALINGAM R - avatar
0
ok
14th Oct 2018, 2:55 PM
RAMALINGAM R
RAMALINGAM R - avatar