Question: 2. More Assignment Specifics This program will prompt the user to enter in a non-negative integer in decimal (base 10). The sum of digits of


2. More Assignment Specifics This program will prompt the user to enter in a non-negative integer in decimal (base 10). The sum of digits of the number value entered will be calculated starting with base 10 representation (as the number was typed) down through base 2 (binary) representation and the sum of digits of the number in each base representation will be displayed. The number value itself does not need to be displayed in any other base representation. As an example given the number input as 23 Base 10: 23/10 2R3-> 2/10 OR2 (end with 0), add remainders 3+2-> sum of digits is 5 Base 9: 23/9 2R5-2/9 OR2, 5+2-> sum of digits is 7 Base 8: 23/8 2R7->2/8 OR2, 72-> sum of digits is 9 Base 7: 23/7 3R2 ->3/7 - OR3, 2 +3 -> sum of digits is 5 Base 6: 23/6 3R5 >3/6 OR3, 5 +3 -> sum of digits is 8 Base 5: 23/5 4R3 -> 4/5 OR4, 3 +4 -> sum of digits is 7 Base 4: 23/4 5R3 ->5/4-1R1-> 1/4-OR1, 3 1+1-> sum of digits is 5 Base 3: 23/3 7R2-7/3 2R1-2/3 OR2, 2 12 ->sum of digits is 5 Base 2: 23/2-11R1-> 11/2 5R1-> 5/2-2R1-> 2/2-1R0-> 1/2-0R1, 1 + 1 + 1 + 0 + 1-> sum of digits is 4 As seen above the base that represents 23 with the greatest sum of digits is 8 and the least sum of digits is base 2 Once the sum of digits has been displayed for each base, the program should indicate which base representation has the greatest sum of digits and which base representation has the least sum of digits. In the case where more than one base representation is tied for greatest sum of digits, indicate the highest base for the greatest sum (base 10 opposed to base 8 or base 2). When multiple base representations tie for the least sum of digits, indicate the lowest base for the least sum (base 2 opposed to base 8 or base 10) For example with the number 5 the greatest sum of digits is 5 in bases 10, 9, 8, 7, and 6, so 10 should be indicated. On the other hand, with the 12 the least sum of digits is 2 in bases 6, 3, and 2 so 2 should be indicated Finally the program should ask the user if they want to input another number. If they do, the program should repeat the process from the beginning with inputting a new number from the user and performing the same set of calculations to generate the correct result (previous numbers entered should have no effect on the current calculations)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
