Question: The provided code needs to be fixed. Fix the code provided, without writing a new code! For each error/typo/bug that you find, add a comment

The provided code needs to be fixed. Fix the code provided, without writing a new code! For each error/typo/bug that you find, add a comment explaining what you fixed (the comments can be short and simple). Here are a few guidelines to follow: You can not simply rewrite the code Avoid deleting chunks of code; the code does work except for the typos/mistakes Avoid adding several lines of new code; the main functionality is already written Each line may have a typo, logic mistake, missing code piece, may be in the wrong location, etc... Leave a comment with a short explanation of the error near the line the mistake was found

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

% 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!