Write a MATLAB script to find the sum and the number of the odd negative numbers in a 𝑁 × 𝑀 matrix ?

5 次查看(过去 30 天)
clear all clc x=input('enter N x M marix '); a=rem(x,2); b=~a; z=~b; d=b .* x; k=d + z; z=prod(prod(k)); disp(['The multiplies of even number is equal to ' num2str(z)]);

回答(1 个)

Vineet Kuruvilla
Vineet Kuruvilla 2022-2-26
B = A(A<0 & (mod(A,2)>0));
sum(B)
size(B,1)

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by