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
Have you ever used a device that relies solely on the cloud?
Morgarella [4.7K]
Yeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeesss i have
8 0
3 years ago
You compared each letter in the correct word to the letter guessed.
Murrr4er [49]

Answer:

wow

Explanation:

www

7 0
3 years ago
Object Linking and Embedding (OLE) data integration allows you to
worty [1.4K]
Hey mate thanks for letting me help you

l just look into this and l got this A set of APIs to create and display a (compound) document, but that is not a choice. so <span>D. edit data in a plain text editor
</span><span>
hope l helped   
</span>
4 0
3 years ago
PLEASE HELP there are TWO ANSWERS
pickupchik [31]

Answer:

Pero un campo cuyo tipo de datos es Número solo puede almacenar datos numéricos. ... Por ejemplo, los valores que se almacenan en un campo Texto solo pueden contener ... Para más información, haga clic en los tipos de datos siguientes. ... Controla la conversión de frases en las versiones asiáticas de Windows.

5 0
3 years ago
Guess the output of this code:print( (3**2)//2 )
V125BC [204]

Answer:

Assuming that's in python, the answer would be 4

Explanation:

The ** operator is for raising a number to a power.

The // operator returns the number of times the right number can fit into the left (i.e round division).

So the answer would be three squared over two rounded down, or 4.

6 0
3 years ago
Other questions:
  • What is the slogan of the sociological school of criticism ?​
    9·1 answer
  • Mica's creating his web page with a software that is free of charge for the first month. If he likes the program, he will have t
    8·2 answers
  • Describe the relative benefits of routing over a broadcast style of communication. Is routed traffic more secure than broadcasti
    14·1 answer
  • Cloud suites are stored on your hard drive and are available anywhere you can access the Internet
    15·1 answer
  • Which of the following does not represent the function of a Variable? Variables store data in memory; this data has limited use
    8·1 answer
  • Does the estimate of a tolerance level of 68.26% of all patient waiting times provide evidence that at least two-thirds of all p
    13·1 answer
  • Does anyone know how to change your username? plz help I don't want my name on this lmo
    8·2 answers
  • B. What significant values have you learned while learning the tools and utensils?
    8·1 answer
  • Another name of computer program is
    6·1 answer
  • What is one way object-oriented programming differs from procedural programming?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!