Problem 1066. Multiples of a Number in a Given Range
Given an integer factor f and a range defined by xlow and xhigh inclusive, return a vector of the multiples of f that fall in the specified range.
Example:
f = 10; xlow = 35; xhigh = 112; multiples = bounded_multiples(f, xlow, xhigh);
Outputs
multiples = [ 40 50 60 70 80 90 100 110 ];
Solution Stats
Problem Comments
-
1 Comment
yurenchu
on 22 Jun 2017
I'd suggest adding test cases in which xlow<0 (and maybe also xhigh<0).
Solution Comments
Show commentsProblem Recent Solvers775
Suggested Problems
-
Find all elements less than 0 or greater than 10 and replace them with NaN
15632 Solvers
-
First non-zero element in each column
878 Solvers
-
middleAsColumn: Return all but first and last element as a column vector
613 Solvers
-
Calculate the area of a triangle between three points
3168 Solvers
-
924 Solvers
More from this Author56
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!