how do you write function divisible(n)?
이전 댓글 표시
The function has one parameter n. If n is divisible by both 3 and 5, the function returns true. Otherwise returns false.
채택된 답변
추가 답변 (1개)
David Sanchez
2014년 3월 4일
Re-using the code above, you can do it in a single line:
function [Res] = divisible(n)
Res = (rem(n,3)==0 && rem(n,5) == 0);
카테고리
도움말 센터 및 File Exchange에서 Encryption / Cryptography에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!