Respuesta :
Answer:
The output is 110 when the question's segment is executed and the input is given as 18,25,61,6,-1.
Explanation:
The program segment is used to add the user input value until the value is not "-1". It means that if a user gives the input "-1" then the program will get terminated and prints the addition of previously entered value by the user. The output is 110 for the input of (18,25,61,6,-1) because the addition of (18,25,61,6) is (110) and "-1" use to terminate the program. The program statement is described below--
- The First statement initiates an object of "Scanner" class which helps to call the input function to take the user input.
- The Second statement initializes the 0 value to the "sum" variable which is an integer type.
- The Third statement calls the "nextInt()" function to take the user input by the help of scanner class object and store it on a num variable which is an integer type.
- The Fourth statement is a "while" loop which gives false when the user's input is "-1".
- The Fifth statement adds the new value with the previously added value.
- The Sixth statement takes the new input from the user.
- The Seventh statement prints the previous added when the loop gets terminated.
Answer:
The program segment is used to add the user input value until the value is not "-1". It means that if a user gives the input "-1" then the program will get terminated and prints the addition of previously entered value by the user. The output is 110 for the input of (18,25,61,6,-1) because the addition of (18,25,61,6) is (110) and "-1" use to terminate the program. The program statement is described below--
The First statement initiates an object of "Scanner" class which helps to call the input function to take the user input.
The Second statement initializes the 0 value to the "sum" variable which is an integer type.
The Third statement calls the "nextInt()" function to take the user input by the help of scanner class object and store it on a num variable which is an integer type.
The Fourth statement is a "while" loop which gives false when the user's input is "-1".
The Fifth statement adds the new value with the previously added value.
The Sixth statement takes the new input from the user.
The Seventh statement prints the previous added when the loop gets terminated.
THANKS
0
0.0
(0 votes)
Still have questions?
FIND MORE ANSWERS
ASK YOUR QUESTION
New questions in Computers and Technology
MEASUREMENTS M Immersive Reader BER DE 10/10 Close Assignment • What is Measurement? . When were the two standards used in measurement develop…
The CPU is located on what part of the computer? the motherboard the system bus the random access memory the hard drive
What is the name of the file in which this program is stored: public class myProgram A. myProgram.class B. myProgram.java C. myProgram.jgrasp D. …
Which of the following statements best describes a high level language? A. The syntax is all 1's and O's. B. The syntax is English-like. C. All hi…
Why is it important to explore an Integrated Development Environment? A. To learn more about the syntax of Java B. To learn more about the features…
Common lossless compressed audio file formats include WMA and JIFF WAV and AU MP3 and MP4a FLAC and ALAC
Prog. 6 : 'Atul Transport Company' charges for the parcels from Delhi to Kolkata or vice versa as per the given tariff: Weight Up to 10 kg. For th…
crees que en algun momento haz co.etido algun delito informatico ¿porque?
How is video compression accomplished? O Video compression works by making the pixel size smaller. O Video compression works by removing the sound…
easy points Cats or dogs? :D
SELECT statement that answers this question: What is the total quantity purchased for each product within each category? Return these columns: categor…
how it print media used?
free brainliest in 100 points
Which of the following takes place during the research phase
How do you delete answers on Brain.ly?
which of the following is not a web browser? A. safari B. explorer C. chrome D. google
The operation of early electronic computing devices required: an operating system (OS). a single human operator. customer-produced helper program …
Which best describes what databases do? O They guarantee users find needed data. O They create categories for data. O They identify important data.…
DO, of X isvvvvvvvvvvvvvvv
Question 27 Which of the following is a key strategy .
Explanation: