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

1 visualización (últimos 30 días)
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)]);

Respuestas (1)

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

Community Treasure Hunt

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

Start Hunting!

Translated by