1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
VARVARA [1.3K]
3 years ago
11

Suppose sum and num are int variables, and the input is 18 25 61 6 -1

Computers and Technology
2 answers:
Sphinxa [80]3 years ago
7 0

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

  1. The First statement initiates an object of  "Scanner" class which helps to call the input function to take the user input.
  2. The Second statement initializes the 0 value to the "sum" variable which is an integer type.
  3. 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.
  4. The Fourth statement is a "while" loop which gives false when the user's input is "-1".
  5. The Fifth statement adds the new value with the previously added value.
  6. The Sixth statement takes the new input from the user.
  7. The Seventh statement prints the previous added when the loop gets terminated.

charle [14.2K]3 years ago
3 0

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:

You might be interested in
Which option is used in order to configure switchboards for a complex database?
Ostrovityanka [42]

Answer:

switch board manager

Explanation:

8 0
3 years ago
Read 2 more answers
Which is a gallery of pr design pictures that can be inserted directly in the document​
fredd [130]

Answer:

.,.,.,.,.,.,.,.,.,.,.,.,.

6 0
3 years ago
What would be one advantage and one risk of using an electric car?
Lemur [1.5K]
One advantage of using an electric car would be not having to pay for gas, one risk would be it malfunctioning.
4 0
3 years ago
Read 2 more answers
Hello people, I was wandering if I could get some people to complete this questionnaire for my business course. It would be very
madam [21]
What do I have to do
3 0
3 years ago
What is the most credible website or webpage you have ever visited?Why is it so credible? Describe some of the qualities that ma
alekssr [168]
I'm not sure, but easybib is very good at finding credible sources. Steer clear of websites like Wikipedia when making research papers, and .com websites, or bias websites
3 0
3 years ago
Other questions:
  • During the Requirements Definition stage of a systems development​ project, the employees who will be the primary users of the n
    15·1 answer
  • On a Linux system, which command allows you to modify settings used by the built-in packet filtering firewall?
    15·1 answer
  • Write a function called "power" that takes in integers b>0 and e≥0 and recursively computes b^3 and returns the result.
    5·2 answers
  • Select the true statement from the choices below. Group of answer choices Invalid code may cause browsers to render the pages sl
    11·1 answer
  • A document that summarizes your employment history and qualifications
    9·1 answer
  • When you see this traffic signal is turned on, you may _____________________.
    5·2 answers
  • What is the typical educational requirement for a non-entry level software programmer? high school diploma technical certificate
    10·1 answer
  • Which of the following is a quality of a mixed economy?
    5·1 answer
  • What type of redundant storage configuration is most common for hosting the operating system and applications on a server
    9·1 answer
  • Does anyone know how to permanently delete photos on a dell computer? For my cousin.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!