Engineering
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.

answer
Answers: 2

Other questions on the subject: Engineering

image
Engineering, 04.07.2019 18:10, hadellolo8839
Acompressor receives the shaft work to decrease the pressure of the fluid. a)- true b)- false
Answers: 3
image
Engineering, 04.07.2019 18:10, abdirahmansoloman
Air is to be cooled in the evaporator section of a refrigerator by passing it over a bank of 0.8-cm-outer-diameter and 0.4-m-long tubes inside which the refrigerant is evaporating at -20°c. air approaches the tube bank in the normal direction at 0°c and 1 atm with a mean velocity of 4 m/s. the tubes are arranged in-line with longitudinal and transverse pitches of sl- st 1.5 cm. there are 30 rows in the flow direction with 15 tubes in each row. determine (a) the refrigeration capacity of this system and (b) pressure drop across the tube bank. evaluate the air properties at an assumed mean temperature of -5°c and 1 atm. is this a good assumption?
Answers: 1
image
Engineering, 04.07.2019 18:10, niyawilliams23
Asingle-geared blanking press has a stroke of 200 mm and a rated capacity of 320 kn. a cam driven ram is assumed to be capable of delivering the full press load at constant force during the last 15 percent of a constant-velocity stroke. the camshaft has an average speed of 90 rev/min and is geared to the flywheel shaft at a 6: 1 ratio. the total work done is to include an allowance of 16 percent for friction a) estimate the maximum energy fluctuation b) find the rim weight for an effective diameter of 1.2 m and a coefficient of speed fluctuation of 0.10
Answers: 1
image
Engineering, 04.07.2019 18:20, sarah7984
Vibration monitoring this technique uses the noise or vibration created by mechanical equipment and in seme cases by plant systems to detemine their actual condtion. a)- true b)- false
Answers: 2
Do you know the correct answer?
(sum the digits in an integer) write a method that computes the sum of the digits in an integer. use...

Questions in other subjects:

Konu
Business, 09.12.2020 18:00
Konu
Spanish, 09.12.2020 18:00