How to check divisibility?

367 visualizaciones (últimos 30 días)
Caped Crusader
Caped Crusader el 20 de En. de 2013
Respondida: Jitesh Kumar el 25 de Sept. de 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.

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 20 de En. de 2013
Editada: Azzi Abdelmalek el 20 de En. de 2013
a=3;
b=2;
out=~rem(a,b)*a/b
  4 comentarios
Caped Crusader
Caped Crusader el 20 de En. de 2013
Thanks ,it works!
Caped Crusader
Caped Crusader el 20 de En. de 2013
However, I used rem(a,b) format after checking the help files and it worked. Anyway thank you very much.

Iniciar sesión para comentar.

Más respuestas (1)

Jitesh Kumar
Jitesh Kumar el 25 de Sept. de 2018
a=5; b=1; rem(a,b)=4

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by