I have to create a function y=D(m,n) where the value of y is m/n if n divides m evenly and n/m if m divides n evenly and otherwise y is zero. I used if and else if statements to define these but I wondering how to define the value of y as an integer.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
function y=D1(m,n)
if m/n== ?
y=m/n;
elseif n/m== ?
y=n/m;
else
y=0;
end
end
0 comentarios
Respuestas (1)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!