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
Archy [21]
3 years ago
10

Write a program that prints the sum of the even numbers and the products of odd numbers on the screen

Computers and Technology
1 answer:
ss7ja [257]3 years ago
4 0

Answer:

The program in Python is as follows:

n = int(input("Number of inputs: "))

total = 0; product = 1

for i in range(n):

   num = int(input(": "))

   if num%2 == 0:

       total+=num

   else:

       product*=num

print("Sum of even: ",total)

print("Product of odd: ",product)

Explanation:

This prompts the user for the number of inputs, n

n = int(input("Number of inputs: "))

This initializes sum (total) to 0 and products to 1

total = 0; product = 1

This iterates through n

for i in range(n):

This gets the inputs

   num = int(input(": "))

If input is even, calculate the sum

<em>    if num%2 == 0:</em>

<em>        total+=num</em>

If otherwise, calculate the product

<em>    else:</em>

<em>        product*=num</em>

Print the required outputs

<em>print("Sum of even: ",total)</em>

<em>print("Product of odd: ",product)</em>

<em />

You might be interested in
Google is an example of a(n):
bixtya [17]
It would B, because anytime you search it always pulls up google search engine.
8 0
3 years ago
Read 2 more answers
What type of USB connector is always plugged into the computer to connect in external device
barxatty [35]
HDMI? I am not entirely sure
4 0
3 years ago
Anyone bug bounty hunter ?​
Pachacha [2.7K]

Answer:

your question is full of doubted

5 0
3 years ago
Como realizar un cuadro comprativo?​
Kruka [31]
How to make a comparison chart?
3 0
3 years ago
According to the text, ________________, although not considered a crime, is viewed as a grave public wrong in many jurisdiction
shtirl [24]

Answer:

$uicide

Explanation:

According to the text, $uicide, although not considered a crime, is viewed as a grave public wrong in many jurisdictions throughout the world.

3 0
3 years ago
Other questions:
  • You use_____ to view an XPS file
    10·1 answer
  • Your computer uses 4 bits to represent decimal numbers (0, 1, 2, 3 and so on) in binary. What is the SMALLEST number
    11·1 answer
  • What is the basic purpose of Google calendar?
    14·2 answers
  • What is the name of the feature that can be enabled on slower-speed WAN links to prevent a large data transfer from affecting th
    10·1 answer
  • The instant pivot button is displayed in the statistics and visualization tabs when a _______ search is run.
    15·1 answer
  • A ___________ is similar to Computer Integrated Manufacturing, but is based much more on standard reusable application software
    5·1 answer
  • Run a Monte Carlo simulation on this vector representing the countries of the 8 runners in this race: runners &lt;- c("Jamaica",
    14·1 answer
  • What is the space complexity of the algorithm?ArithmeticSeries(list, listSize) { i = 0 arithmeticSum = 0 while (i &lt; listSize)
    14·1 answer
  • Hola, alguien aquí me podría ayudar dándome ideas a cerca de office (Word, PowerPoint o Excel) estoy desesperada no puedo pensar
    11·1 answer
  • Please help me please please
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!