using max function without conditional function
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
dpb
2020 年 8 月 29 日
As this is obviously homework, it's not kosher to just provide the answer ... but hint: look at
回答 (1 件)
Walter Roberson
2020 年 8 月 29 日
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 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!