Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

functions that give multiples

조회 수: 1 (최근 30일)
Clare Bork
Clare Bork 2017년 3월 15일
마감: MATLAB Answer Bot 2021년 8월 20일
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

답변 (1개)

Roger Stafford
Roger Stafford 2017년 3월 15일
count = length([i:i:n,j:j:n]);

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by