Question: A positive integer is evenly divisible by 9 if and only if the sum of all its digits is divisible by 9 . Suppose you

A positive integer is evenly divisible by 9 if and only if the sum of all its digits is divisible by 9 . Suppose you have a method sumDigits that returns the sum of the digits of a positive integer n. Fill in the blanks in the method isdivisibleBy 9 (int n ) that returns true if n is divisible by 9 and false otherwise. Your method may use the assignment and relational operators and sumDig its, but no arithmetic operators (,/, 8s,=,/=,bs=) are allowed. // Returns n o 9=0 // Precondition: n>0 public boolean isdivisibleBy (int n) f if ( return else if ( return else return
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
