Code:
public class practical11{
public static void main(String[] args) {
int i,j,count1=0,count2=0;
int matrix[][] =new int[6][6];
System.out.println("6*6 two dimensional matrix is : ");
for(i=0;i<6;i++){
for(j=0;j<6;j++){
matrix[i][j]=(int) (Math.random()*2);
System.out.print(matrix[i][j]+" ");
}
System.out.println();
}
for(i=0;i<6;i++){
for(j=0;j<6;j++){
if(matrix[i][j]==1){
count1++;
}
if (matrix[j][i]==1){
count2++;
}
}
if(count1%2!=0){
System.out.println("Row "+(i+1)+" contains odd number's of 1's");
}
if(count2%2!=0) {
System.out.println("Column "+(i+1)+ " contains odd number's of 1's");
}
count1=0;
count2=0;
}
}
}
Sir please make video to explain this code
ReplyDelete