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
Different between input and output device​
chubhunter [2.5K]

Answer:

An input device is something you connect to a computer that sends information into the computer. An output device is something you connect to a computer that has information sent to it.

Explanation:

8 0
3 years ago
How many keys are on a microsoft windows standard keyboard
DiKsa [7]

There are 101 keys on a microsoft windows standard keyboard

7 0
4 years ago
Read 2 more answers
You need to view the contents of /var/log/auth.log to get information about the users that have been logging on to the system. T
leva [86]

Answer:

more /var/log/auth.log

less /var/log/auth.log

Explanation:

The commands that can be used to view the content of the auth.log file page by page are:

more /var/log/auth.log

less /var/log/auth.log

5 0
3 years ago
What should you do before you share your information on the internet?
satela [25.4K]

You have to think about, what could happen to you if you shared this information.

Hope this helped!

~Izzy

4 0
4 years ago
Pressing and holding the _______ key while dragging a corner handle of an image proportionally resizes it.
siniylev [52]
Shift key is correct key
3 0
3 years ago
Read 2 more answers
Other questions:
  • When you don't have enough room to stop, you may _______ to avoid what's in front of you. A. speed up B. steer away C. brake
    7·2 answers
  • o maintain reasonable key security (mark all that apply): Ensure that someone else always has an extra key. Ensure that no extra
    10·1 answer
  • Which of the following is NOT part of the Ethernet standards? O 1.802.3 O 2.802.2 O 3 LLC O4 pPp
    12·1 answer
  • What is the term used to describe a computer system that can store literary documents, link them according to logical relationsh
    5·1 answer
  • Which encryption standard goes with the WPA2 protocol?<br> AES<br> DES<br> TKIP<br> WPS
    15·1 answer
  • Guys please join this link... I want friends...
    7·2 answers
  • As a student, how will you avoid those problems/case in the community?​
    14·2 answers
  • Which of the following pieces of evidence was NOT used to support the Theory of Continental Drift?
    10·1 answer
  • Need some help writing a simple PYTHON Student registration program:
    5·1 answer
  • Before entering an intersection, the safest searching process is to search ________. right, left, right, center left, center, ri
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!