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]
3 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]3 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
Why was unicode invented
Luden [163]
Uni code is short for universal code , it was created so that all countries could communicate together without the need for special encoding for each country
7 0
3 years ago
Open this link after reading about Ana's situation. Complete each sentence using the drop-downs. Ana would need a minimum of ato
Arte-miy333 [17]

bachelor degree and grow

6 0
3 years ago
Read 2 more answers
List the five body functions that monitor homeostasis.
IceJOKER [234]
You can also have homeostatis by shivering and sweating

6 0
3 years ago
3. How are you able to create photographs differently than 100 years ago?
Agata [3.3K]

Answer:

it willbe black and white

Explanation:

3 0
3 years ago
Read 2 more answers
What are the missing letters _A_TO_ ( 6 letters) a type of computer.
aliina [53]

Explanation:

its a laptop ☺️. . . . . .. . .

4 0
3 years ago
Read 2 more answers
Other questions:
  • The ____ file permission category in unix/linux systems typically entails all permissions and is designated by the letter u.
    7·1 answer
  • Write c program to check character is alphabate or not?​
    15·1 answer
  • Which type of footwear should be worn while working on a hybrid vehicle?
    8·2 answers
  • HTTP is the protocol that governs communications between web servers and web clients (i.e. browsers). Part of the protocol inclu
    5·1 answer
  • _____________ helps to control and limit the number of consecutive request failures that cross a threshold. Review breaker Micro
    7·1 answer
  • Is there any difference beetween the old version of spyro released on the origional and the newer ones??? or is it only change i
    8·1 answer
  • A human subject’s photographs show two catchlights in each eye that are unwanted by the photographer. What is the most likely ca
    12·1 answer
  • Write a paragraph discussing privacy issues on the internet<br> and their impact on human lives.
    9·1 answer
  • Software that enables the organization to centralize data is called A. Data Repository B. Data Base Management System C. Data Wa
    6·1 answer
  • Another word for asking a question of your data is to _____ it.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!