Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

functions that give multiples

1 Ansicht (letzte 30 Tage)
Clare Bork
Clare Bork am 15 Mär. 2017
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
I want to write a function with 3 variables (i,j,n). I want the multiples of i and j, but only up to whatever number n is. I then want to display the number of multiples there are (not the exact numbers of the multiples). This is not a homework problem. I'm reviewing problems from matlab books for an exam. This has a twist on the one given.
I want to be able to put in a function like... multiples(3,4,10) and get an output such as (3,6,9,4,8)... ans = 5

Antworten (1)

Roger Stafford
Roger Stafford am 15 Mär. 2017
count = length([i:i:n,j:j:n]);

Diese Frage ist geschlossen.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by