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
Rufina [12.5K]
2 years ago
5

Write a program that: Takes the list lotsOfNumbers and uses a loop to find the sum of all of the odd numbers in the list (hint:

use Mod). Displays the sum.
Computers and Technology
1 answer:
Alika [10]2 years ago
5 0

Answer:

Following are the code to this question:

#include <iostream>//defining header file

using namespace std;

int main()//defining main method

{

int x[]={2,3,4,6,7,8,9,1,11,12};//defining 1-D array and assign value

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

for(i=0;i<10;i++)//defining loop for count value

{

   if(x[i]%2==1)//defining if block to check odd value

   {

       sum=sum+x[i];//add value in sum variable

   }

}

cout<<sum;//print sum

return 0;

}

Output:

31

Explanation:

In the above-given program, an integer array "x" is declared that holds some integer values, and in the next line two integer variable "i and sum" is defined which is used to calculate the value.

In the next line, a for loop is declared, that counts all array value, and it uses the if block to check the odd value and add all the value into the sum variable.

You might be interested in
How many grams are in 100 pounds?
stepan [7]

Answer:

45359.2 grams are in 100 pounds

Explanation:

Hope this helped, Have a Wonderful Day!!

3 0
2 years ago
Read 2 more answers
Which of the following best explains the concept of a prototype
gladu [14]
A prototype<span> is an early sample, model, or release of a product built to test a </span>concept<span> or process or to act as a thing to be replicated or learned from. It is a term used in a variety of contexts, including semantics, design, electronics, and software programming.</span>
3 0
2 years ago
What does a spam e-mail normally promise you?
nlexa [21]
The answer is a virus
7 0
3 years ago
What provision of the Government Paperwork Elimination Act was designed to encourage a paperless society?
Ratling [72]
<span>Validation of electronic signatures was designed to encourage a paperless society.</span>
8 0
3 years ago
Read 2 more answers
The force that pulls away from a curve is known as
77julia77 [94]

The correct answer is centrifugal force.

The force that pulls out from the center on a body that is in a circular motion is called centrifugal force. This force increases as the speed of motion increases. It is centrifugal force that results in a strong outward pull on your vehicle traveling around a corner.

7 0
3 years ago
Other questions:
  • __________ refers to rules, statutes, codes, and regulations established to provide a legal framework within which business may
    13·1 answer
  • As in algebra, you can use brackets to override the order of operations Excel follows to perform formula calculations. True or f
    13·1 answer
  • If you will be giving your presentation to an audience, you can practice your presentation by using View, ___________, to rehear
    14·1 answer
  • Check my work a(n) ________ reference is an automatically created variable that holds the address of an object and passes it to
    15·1 answer
  • what is the purpose of the Outline view in word 2016? check all that apply. 1. editing the format of size and text. 2.working wi
    11·1 answer
  • Which software is primarily used to create
    15·2 answers
  • Which key combination should you use
    9·2 answers
  • Write an algorithm (in pseudocode) for the following Scenario.
    7·1 answer
  • Edge is a video game featuring interactive extreme sports. The graphics used in the game are protected by
    8·1 answer
  • 8. Which of the following is an output device
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!