How to check divisibility?
364 views (last 30 days)
Show older comments
Caped Crusader
on 20 Jan 2013
Answered: Jitesh Kumar
on 25 Sep 2018
Hi, I need to check whether two numbers are divisible or not. But how can I do that in Matlab? e.g. Matlab gives 1.5 for 3/2 but I need to get 3/2 = 0 and 4/2 =2.
0 Comments
Accepted Answer
Azzi Abdelmalek
on 20 Jan 2013
Edited: Azzi Abdelmalek
on 20 Jan 2013
a=3;
b=2;
out=~rem(a,b)*a/b
4 Comments
More Answers (1)
See Also
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!