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
Greeley [361]
4 years ago
14

Initialize an int variable named as sum to 0. Write the while loop that lets the user enter a number. The number should be added

to sum and the result is stored back to the variable sum. The loop should iterate as long as sum contains a value less than 200. After the loop stop, display message: "sum = - the loop stops"
Computers and Technology
1 answer:
FromTheMoon [43]4 years ago
8 0

Answer:

Following are the program to this question:

#include<iostream> //defining header file

using namespace std;  

int main() //defining main method

{

int sum = 0, num; //defining integer variable  

cout << "Enter a number :"; // print message

cin >> num; //input number

sum=sum+num;

while (sum < 200)  //defining loop that check sum value is less then 200

{

cin >> num; //input number by user

sum =sum+num; //add values

}

cout << "Sum = " << sum <<" the loop stops"; //print values

return 0;

}

output:

Enter a number :44

66

90

Sum = 200 the loop stops

Explanation:

In the given C++ program, the main method is declared, inside the method two integer variable "sum and num" is declared, in which sum variable assign a value, that is 0, and num is used to take input from the user end.

  • In the next step, a sum variable adds num variable value and use a while loop that checks value is less than 200.  
  • In this condition is not true so, inside the loop, it takes value from the user and into the sum variable when its value is above 200, it will exit the loop and prints its total value.
You might be interested in
Write a static method named listcountriesoforigin, to be added to the bowl class, which is passed an array of bowl objects, and
melomori [17]
<span>I guess, this is java. Try that code:
public static String listCountriesOfOrigin (Bowl[] bowls) {
</span>for(int i = 0; i < bowls.length; i++) {<span> String origin = bowls[i].getOrigin();
</span><span>System.out.println(origin)</span><span>; }
}</span>
7 0
4 years ago
If you want an app to reach the largest possible audience, which two platforms should you use?
Papessa [141]

Android Studio for Android, and Xcode for Apple devices.

6 0
3 years ago
I have a question, but it's not a math question. Can anyone give me 5 unblockers for school computers? If you answer this, you w
ValentinkaMS [17]

Answer:

I mean if your talking about games then just try Cool math I will give link in comments

Explanation:

4 0
2 years ago
Read 2 more answers
Is technology uniting or isolating people
kramer

In my opinion, technology is uniting people, especially nowadays technology has helped friends and family that live far to communicate with each other, it has brought families close when they sit in the living room watching some movie.

7 0
3 years ago
Read 2 more answers
Source Code for TF2 - Please insert it here
Advocard [28]

Answer:

Hi T!

Explanation:

How are you?

3 0
3 years ago
Other questions:
  • Briefly describe the significance of the shannon limit for information capacity.
    5·1 answer
  • Provide an example of a closed‐end credit account that Caroline has.
    6·1 answer
  • When registering a new domain name, either the registrar's servers or self-owned servers can be used as name servers. What funct
    15·1 answer
  • What are the benefits of using disk cleanup as part of regular maintenance on a computer​
    8·1 answer
  • Write the definition of a class Telephone. The class has no constructors, one instance variable of type String called number, an
    9·1 answer
  • Explain how a monitor can display the letters that you type on a keyboard. (Hint: Three Basic Computer Functions) *
    11·1 answer
  • "Businesses around the world all need access to the same data, so there needs to be one type of information system that is desig
    13·1 answer
  • Help a brotha out..................
    10·1 answer
  • help i was building my pc and i pushed the cpu into the socket really hard until there was an audible crack and it went into the
    7·1 answer
  • 1. Give one reason why data is represented in binary in a computer [1]
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!