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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started