+ 6
How to find duplicate values in 3×3 matrix in c?
17 Antworten
+ 7
RAMALINGAM R now its perfect !! Thanks alot for helping 😊
+ 7
RAMALINGAM R yes its working but its showing repeating values twice
+ 6
RAMALINGAM R
It shows all values and also shows duplicate values twice..
+ 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
+ 3
RAMALINGAM R yes you are right ..
+ 2
then add this line to add exception
if (i==k && j==l)
{
continue;
}
+ 2
s because two times it satisfies the condition
eg:
X23=X15
X15=X23
+ 2
RAMALINGAM R Now its perfect !! 👍
+ 2
Thanks for helping 😊
+ 1
use 4 loops
+ 1
before the if condition
+ 1
is it working??
+ 1
then add a brea; command after printf
+ 1
break;
+ 1
ok
0
X12=X22
X22=X12
0
ok