using max function without conditional function
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
how using max function, logical operators and comparison operators to write a code that if a number larger than 100, then return the difference between thwo values, and this number smaller than 100 then return 0.
6 comentarios
dpb
el 29 de Ag. de 2020
As this is obviously homework, it's not kosher to just provide the answer ... but hint: look at
Respuestas (1)
Walter Roberson
el 29 de Ag. de 2020
A > B implies A - B > 0 . Which implies that the maximum of (A-B) and (0) is (A-B).
A < B implies A - B < 0. Which implies that the maximum of (A-B) and (0) is (0).
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!