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
"Technician A says that Ohm's law can be used to determine circuit current flow if total circuit resistance and total voltage ar
Troyanec [42]

Answer:

Both Technicians are correct.

Explanation:

Remember that Ohm's Law its a relationship between Voltage (E), Current (I) and Resistance (R) in an electrical circuit. This relationship is defined by the following equation:

E=I*R

Each one of the letters could be called a variable. Now, also remember that the number of equations you have is equal to the number of variables unknown you could have.

In Ohm's Law you have 3 variables (E,I,R) and 1 equation. It means that you need to know 2 variables (Whatever 2 variables) to know the third.

Technician A says, in other words, that could calculate the Circuit current flow (I) knowing total circuit resistance (R) and total voltage (E). Note that Technician A knows 2 to 3 variables, then it's possible to use Ohm's Law with the following equation:

I=\frac{E}{R}

Technician B says, in other words, that could determine the unknown resistance (R) knowing total current (I) and source voltage (E). Once again, note that Technician B knows 2 to 3 variables, then it's possible to use Ohm's Law with the following equation:

R=\frac{E}{I}

It is concluded that both technicians are right.

6 0
3 years ago
How we can earn from an app​
miss Akunina [59]

Answer:

Hewo, Here are some ways in which apps earn money :-

  • Advertisement
  • Subscriptions
  • In-App purchases
  • Merchandise
  • Physical purchases
  • Sponsorship

hope it helps!

5 0
3 years ago
In the past, workers would usually complete ______. a. A variety of tasks on a daily basis b. The same tasks every day c. Thinki
yKpoI14uk [10]

Answer:

B

Explanation:

did it on edge

5 0
3 years ago
Read 2 more answers
Which activity is performed during high-level design in the V-model?
SVETLANKA909090 [29]

Answer:

understanding component interaction

4 0
3 years ago
A(n) _____ identifies how you feel about an activity or subject. computer calculator interest inventory both b and c
Alexeev081 [22]

Answer:

Interest

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • George borrowed some equipment from his friend for recording his monologue for his art class. He got all the equipment except th
    15·1 answer
  • Discuss anomaly detection.
    5·1 answer
  • Refer to the exhibit. If a hacker on the outside network sends an IP packet with source address 172.30.1.50, destination address
    11·1 answer
  • An ideal line length would include how many characters? A. 6570 B. 100 C. 100125 D. 4055
    8·1 answer
  • use the internet to research the SYSTEM account. Why is it nessesary to include this account with full control on a directory
    13·1 answer
  • Use the function random.randint to write a program that rolls a 6-sided die 100 times, and prints out all of the rolls.
    8·1 answer
  • Unscramble the given word and identify the correct statement about it. ATTEPLSR
    10·1 answer
  • What is the difference between HTML and XML?
    8·1 answer
  • Write a FOR loop that displays the following numbers exactly like this (you must use a loop):
    15·1 answer
  • Technology __________ guides how frequently technical systems are updated, and how technical updates are approved and funded.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!