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

Other questions on the subject: Engineering

image
Engineering, 03.07.2019 23:20, abbz13
Two technicians are discussing the intake air temperature (iat) sensor. technician a says that the computer uses the iat sensor as a backup to the engine coolant temperature (ect) sensor. technician b says that the powertrain control module (pcm) will subtract the calculated amount of fuel if the air measures hot. who is correct
Answers: 3
image
Engineering, 04.07.2019 18:10, dval1146
You are making beer. the first step is filling the glass carboy with the liquid wort. the internal diameter of the carboy is 15 in., and you wish to fill it up to a depth of 2 ft. if your wort is drawn from the kettle using a siphon process that flows at 3 gpm, how long will it take to fill?
Answers: 1
image
Engineering, 04.07.2019 18:10, Candi9697
A-mn has a cubic structure with a0 0.8931 nm and a density of 7.47 g/cm3. b-mn has a different cubic structure, with a0 0.6326 nm and a density of 7.26 g/cm3. the atomic weight of manganese is 54.938 g/mol and the atomic radius is 0.112 nm. determine the percent volume change that would occur if a-mn transforms to b-mn.
Answers: 2
image
Engineering, 04.07.2019 18:20, sanchez626
Aheavily insulated piston-cylinder device contains 0.02 m3 of steam at 300 kpa and 200 °c. 1.2 mpa. d this process. team is now compressed in a reversible manner to a pressure of etermine the entropy change and the work done on the steam during this process
Answers: 1
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 in other subjects:

Konu
Mathematics, 29.08.2020 22:01