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

4 vues (au cours des 30 derniers jours)
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)]);

Réponses (1)

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

Catégories

En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by