Question: Matlab Given a positive integer N, find the lowest multiple of N made up of only 9s and 0s! I need help debugging this matlab

Matlab

Given a positive integer N, find the lowest multiple of N made up of only 9s and 0s!

I need help debugging this matlab code! My code keeps running forever, it seems to be having a problem with the continue part.

% Lowest multiple with 9s and 0s

clc; clear;

N = input('Enter a positive whole number N: ','s');

cnt = 1;

while true

M = N*cnt;

while M >= 1

remainder = mod(10,M);

if remainder ~= 9 || remainder ~= 0

continue;

else

M = floor(M*10);

end

end

if M < 1

break;

end

cnt+1;

end

fprintf('Lowest multiple with only 9s and 0s: %d ',N)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!