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

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

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!