using a while loop, divide the number 256 by 7 until the value remaining is less than one
Show older comments
assign the final value to output variable WhatsLeft and count the number of divisions required and assign the result to variable DivisionCount
number = 256;
whatsLeft = number<1
while number>1
number = number/7
end
divisonCount = cnt number/7
cnt
end
2 Comments
Walter Roberson
on 31 Aug 2022
divisonCount = cnt number/7
could you explain that line? Taking into account that you would not have left the loop until number became less than 1
Tshitso
on 29 Apr 2024
the ubove does not run but the one chunru gave use does.
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!