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
Why a design that doesn't fail initially fails after some time/use? identify at least 3 such mechanisms?
alina1380 [7]
Runs out of memory
has uninitialized    variables
uses  undefined behaviour

4 0
3 years ago
What color is excel?​
Eduardwww [97]

Answer:

green

Explanation:

5 0
3 years ago
Read 2 more answers
The word blog is made from what two terms?
mafiozo [28]
• web + log = blog •
3 0
4 years ago
Beth would like to eavesdrop on network traffic resulting from users browsing the Web. Which port would provide her with the mos
Elis [28]

Answer:

port 80

Explanation:

port 80 is http. port 443 is https. so if you are trying to be a sneaky little person and eavesdrop on people, eavesdrop on port 80 not port 443 because port 80 is unsecured plaintext data transmission over websites

7 0
3 years ago
To securely erase data, the u.s. department of defense suggests that the data be overwritten ________ times.
Stels [109]
The course that will tackle this topic is computers and technology. The answer to the given problem above is "7".

To securely erase date, the United States department of defense suggest and propose that the data can be overwritten 7 times.
4 0
3 years ago
Other questions:
  • A network administrator is implementing dhcpv6 for the company. the administrator configures a router to send ra messages with m
    6·1 answer
  • Could this be restored? And is it worth the money it’d take?
    9·2 answers
  • Which statement regarding socializers is true?
    10·2 answers
  • What is work flexibility?
    15·1 answer
  • Hi whats airpods good for
    15·2 answers
  • Kelly is a college sophomore majoring in computer science. She is interested in gaining exposure to the most useful and current
    13·1 answer
  • Variable-length entities. fixed-length entities. data structures that contain up to 10 related data items. used to draw a sequen
    14·1 answer
  • Please help meeee , you will get 20 points
    9·2 answers
  • Explain the concept of conditional formatting​
    9·1 answer
  • Which key doesn't relate to keyboard A:return key B :enrollment key C: delete key D:tab key
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!