Question: In Exercise 1.6 you wrote MATLAB code to check if an integer was divisible by 9 by summing its digits: if the digits add up

 In Exercise 1.6 you wrote MATLAB code to check if an

In Exercise 1.6 you wrote MATLAB code to check if an integer was divisible by 9 by summing its digits: if the digits add up to 9 the number is divisible by 9. For integers up to 90 only a single application of the rule is required. For larger integers, multiple applications may be required. For example, for 99 , the digit sum is 18 . Then, because 18 still has multiple digits we sum them again to get 9 , confirming that 99 is divisible by 9 (after two steps). In general, for a given starting number, you should repeatedly sum the digits until the result is a single digit number. Write a MATLAB script m-file to read in a single number from the keyboard, and use the rule to determine if it is divisible by 9 . An appropriate message should be displayed depending on the result. You can assume that the number will always be less than 1000

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!