Question: Translate the following pseudocode to java. Do not write a complete program with main method, just the algorithm given. The algorithm will sum the digits
Translate the following pseudocode to java. Do not write a complete program with main method, just the algorithm given. The algorithm will sum the digits of a positive integer. Assume that n was declared and assigned prior to the algorithm, all other variables used in your java code must be declared. number =n sumd =0 while number >0 add number mod 10 to sumd number = number div 10 print that the sum of the digits of n is sumd
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
