subject
Engineering, 02.11.2019 03:31 bks53

(sum the digits in an integer) write a method that computes the sum of the digits in an integer. use the following method header: public static int sumdigits(long n) for example, sumdigits(234) returns 9 (2 + 3 + 4). (hint: use the % operator to extract digits, and the / operator to remove the extracted digit. for instance, to extract 4 from 234, use 234 % 10 (= 4). to remove 4 from 234, use 234 / 10 (= 23). use a loop to repeatedly extract and remove the digit until all the digits are extracted. write a test program that prompts the user to enter an integer and displays the sum of all its digits.

ansver
Answers: 2

Another question on Engineering

question
Engineering, 03.07.2019 14:10
Amass of m 1.5 kg of steam is contained in a closed rigid container. initially the pressure and temperature of the steam are: p 1.5 mpa and t 240°c (superheated state), respectively. then the temperature drops to t2= 100°c as the result of heat transfer to the surroundings. determine: a) quality of the steam at the end of the process, b) heat transfer with the surroundings. for: p1.5 mpa and t 240°c: enthalpy of superheated vapour is 2900 kj/kg, specific volume of superheated vapour is 0. 1483 m/kg, while for t 100°c: enthalpy of saturated liquid water is 419kj/kg, specific volume of saturated liquid water is 0.001043m/kg, enthalpy of saturated vapour is 2676 kj/kg, specific volume of saturated vapour is 1.672 m/kg and pressure is 0.1 mpa.
Answers: 3
question
Engineering, 04.07.2019 18:10
If a particle moves along a path such that r : (3 sin t) m and ? : 2t rad, where t is in seconds. what is the particle's acceleration in m/s in 4 seconds? a)- 16.43 b)- 16.29 c)- 15.21 d)- 13.79
Answers: 1
question
Engineering, 04.07.2019 18:10
Afull journal bearing has a journal diameter of 27 mm, with a unilateral tolerance of -0.028 mm. the bushing bore has a diameter of 27.028 mm and a unilateral tolerance of 0.04 mm. the l/d ratio is 0.5. the load is 1.3 kn and the journal runs at 1200 rev/min. if the average viscosity is 50 mpa-s, find the minimum film thickness, the power loss, and the side flow for the minimum clearance assembly.
Answers: 1
question
Engineering, 04.07.2019 18:10
Burgers vector is generally parallel to the dislocation line. a)-true b)-false
Answers: 2
You know the right answer?
(sum the digits in an integer) write a method that computes the sum of the digits in an integer. use...
Questions
question
Mathematics, 16.05.2021 05:30
question
History, 16.05.2021 05:30
question
Chemistry, 16.05.2021 05:30