x = randi(100,10,10);
count = 0;
for i=1:10
    for j=1:10
        if x(i,j)==42
            count = count +1;
        end
    end
end
disp(count);
            