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]
2 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]2 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
How to move files and folders from desktop in w10?
Oksana_A [137]
Press CTRL + X to cut the file(s) and folder(s) you wish to move from your desktop.

Go to your destination (where you would like to move them to), and press CTRL + V to paste them there.
4 0
3 years ago
What are your undertale + au ships?
fenix001 [56]
What is an undertale? Lol
3 0
3 years ago
All of the language commands that the CPU understand make up the CPU's
disa [49]
I think assembly level command mov ,push ,call
5 0
3 years ago
11. Describe an algorithm that interchanges the values of the variables x and y, using only assignments. What is the minimum num
Svetlanka [38]

Answer:

Following is the algorithm to interchange the value of two variable x and y.

step 1:Read the two integer x and y.

step 2 :t=x

Step 3: x=y  

step 4: y=t

The minimum number of assignment to do this is 3

Explanation:

After reading two integer x & y, create a variable "t" of integer type.

with the help of variable "t", we can swap the value of variable x and y.

It requires 3 assignment to interchange the value.

6 0
3 years ago
Who is the person responsible for creating the original website content?
Romashka [77]

Answer: D) Content creator

Explanation:

  • Content creator are responsible for creating the original content of the website. They contribute writing the blog posts about various topics and promote the content with the help of digital and social media.
  • Content creator are basically responsible for writing blog post on the industry based topics, graphic design and video editing.

Content editor uses data and evaluation from the users for analysis. It basically includes design and development to enhanced the material on the website.

Static and dynamic information are related to computer terminologies.

Therefore, (D) option is correct.

8 0
2 years ago
Other questions:
  • Which fingers do you use to type the following letters rtgvf
    11·1 answer
  • When you park facing downhill and there is a curb, turn your wheels _____ the curb. When you park facing uphill and there is a c
    13·2 answers
  • I need help answering these questions!
    11·1 answer
  • What is the fastest way to locate a record for updating?
    6·1 answer
  • The person who can give a short defination of subroutine will get the brainliest.
    9·1 answer
  • What is a relationship between a object and a class?
    7·1 answer
  • Chunking is a good strategy for completing large assignments because it makes the work
    7·2 answers
  • What does “human-like” mean when we are talking about a machine?
    7·1 answer
  • Ask the user to input a number less than 100. Print all the numbers from that number to 100.
    6·2 answers
  • How do people and computers approach problems differently
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!