Suppose number is an integer variable. Write Java expressions for the following:
ID: 3792484 • Letter: S
Question
Suppose number is an integer variable. Write Java expressions for the following: A boolean expression that is true if and only if number is a positive two to five-digit number: An arithmetic expression that gives the difference between the remaining digits and 9 times the last digit of number. For example, if the number is 923, then the expression should be 92 - 9 times 3 which evaluates to 65. Using the expressions from D. and D. write a Boolean expression that is true, if and only if, number is a positive two to five-digit integer the difference of whose remaining digits and 9 times its last digit is divisible by 13.Explanation / Answer
a. A boolean expression that is true if and only if number is positive two to five digit number.
number > = 10 && number <= 99999 ? true : false
b. An arithmetic expression that gives the difference between the remaining digits and 9 times
the last digit of number.
number / 10 - number % 10 * 9.
c. Using the expressions from D.(a) and D.(b), write a Boolean expression that is true, if and only
if, number is positive two to five-digit integer the difference of whose remaining digits and 9
times its last digit is divisible by 13.
(number > = 10 && number <= 99999 && (number / 10 - number % 10 * 9) % 13 == 0) ? true : false.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.