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
kirill115 [55]
4 years ago
5

Write a loop that reads positive integers from console input, printing out those values that are even, separating them with spac

es, and that terminates when it reads an integer that is not positive.
Computers and Technology
1 answer:
Vikentia [17]4 years ago
3 0

#include <iostream>

#include <string>

int main(){

int number = 1;

while(number >= 1){

   std::cin >> number;

   if((number % 2) == 0){

       std::cout << number << " ";

       }

   }

   return 0;

}

You might be interested in
Write a program that reads an integer, and then prints the sum of the even and odd integers.
Tasya [4]

Answer:

#include <iostream>  // header file

using namespace std;  // namespace

int main ()

{

int n, x1, i=0,odd_Sum = 0, even_Sum = 0;  // variable declaration

cout << "Enter the number of terms you want: ";

 cin >> n;  // user input the terms

cout << "Enter your values:" << endl;

  while (i<n)  // iterating over the loop

{

cin >> x1;  // input the value

if(x1 % 2 == 0)  // check if number is even

{

even_Sum = even_Sum+x1;  // calculate sum of even number

}

else

{

odd_Sum += x1; // calculate sum of odd number.

}

i++;

}

cout << "Sum of Even Numbers is: " << even_Sum << endl;  // display the sum of even number

cout << "Sum of Odd Numbers is: " << odd_Sum << endl;  // display the sum of odd number

return 0;

}

Output:

Enter the number of terms you want:3

Enter your values:2

1

78

Sum of Even Numbers is:80

Sum of Odd Numbers is:1

Explanation:

In this program we enter the number of terms by user .After that iterating over the loop less then the number of terms .

Taking input from user in loop and check the condition of even. If condition is true then adding the sum of even number otherwise adding the sum of odd number.

Finally print the the sum of the even number and odd integers.

6 0
3 years ago
Someone knows a good compiler for iPad? It has to be an app
aksik [14]
Jedona is a good one
5 0
3 years ago
The term that refers to the standard computer language for creating web pages is called:
Pavel [41]

Answer:

Language programming Web's programming language

Explanation:

6 0
4 years ago
Paul has been working long hours. He is tired and distracted by family issues, so he has not been doing record updates regularly
mina [271]

Answer:

Accidental data loss

Explanation:

Accidental data loss -

It refers to the removal or loss of certain data or information from the computer , due to some accident , is referred to as accidental data loss .

The loss of data can be due to some malicious intruders , or can be due to the fault of the user .

The information can be lost due to sudden power cut , natural calamities like fires , flood earthquake etc. , problem in hard disk etc.

Hence , from the given scenario of the question ,

The correct option is accidental data loss.

4 0
3 years ago
I can't find the errors! Could anyone help me please?!
enot [183]
The only syntax error I saw was that the re pattern should have been double quoted.

Other non-syntax errors are: the import statement doesn't have a valid module name. It should be "import re" . Since tutorGroup is double quoted in the re.match(), it becomes a string, not the variable from the input() function.

4 0
3 years ago
Other questions:
  • Which step can most directly help your team follow up on decisions made during Web development meetings?This task contains the r
    6·1 answer
  • Universal Container sales reps can modify fields on an opportunity until it is closed. Only the sales operations team can modify
    13·1 answer
  • An administrative assistant types a document, saves, and prints. The assistant is using _____.
    13·1 answer
  • Question 1<br> REVPAR and REVPOR are basically the same thing.<br> True<br> False
    11·1 answer
  • A common practice is to create a(n) _____ on any field that is used as a search key, in comparison operations in a conditional e
    6·1 answer
  • Match each item with a statement below. - A popular port scanners that has the ability to use a GUI front end - Allows you to pi
    8·1 answer
  • There used to be a popular type of pulp book for younger readers. They were called "Choose Your Own Adventure" novels. The idea
    9·1 answer
  • The first step of converting data into a table is:
    12·1 answer
  • Advantages of monolithic operating system? ​
    6·1 answer
  • Why is it important to enforce access controls and to keep logs regarding who has access to data closets
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!