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
The range A2:B4 has how many cells?   A. 2   B. 4   C. 6   D. 8
olya-2409 [2.1K]
The answer to that is D.
3 0
3 years ago
Read 2 more answers
(asking again because point-hogs exist)
yawa3891 [41]

The answer is 2-to-the-power-of-n, since for every input, the number of different combinations doubles. From your list I think answer A is meant to indicate 2ⁿ.

6 0
2 years ago
Within a word processing program, predesigned files that have layout and some page elements already completed are called
dexar [7]

Answer:

I think it's B) templates

     

                   Sorry if it's wrong I'm not sure!!

Explanation:

4 0
3 years ago
Which is the best description of a computer virus?
MatroZZZ [7]
The best description of a computer virus is. Someone first starts out making a malicious program, then can send it to a unexpected user. After that, when the user opens the malicious program, it can do negative things on the target. The virus first starts out in the system32, then infects a random file type for example, exe files, or dlls etc. Then random errors can pop up on the computer saying "YOUR COMPUTER IS UNDER RISK! CALL THIS NUMBER NOW! 555-555-5555" and the options of the error, can direct you to a website, that can give you another virus. To get rid of a virus, you have to ignore the popups that comes onto your computer, and get a strong antivirus like avast, or avg. Then let it scan the system. After when the scan is done, it will show up the virus, and it will give you options "to delete virus or ignore it" you would hit delete. I hope this answer helped you. Let me know if you have any more questions! Thanks!
6 0
2 years ago
Read 2 more answers
*/ What's wrong with this program? /* public MyProgram { public static void main(String[] args); } int a, b, c \\ Three integers
gulaghasi [49]

Answer:

A lot is wrong with the program given in the question. See the corrected version below:

<em>public class ANot {</em>

<em>    public static void main(String[] args) {</em>

<em>        int a, b, c;</em>

<em>    //Three integers</em>

<em>    a = 3; b = 4; c = a + b;</em>

<em>        System.out.println("The value of c is " + c);</em>

<em>    }</em>

<em>}</em>

Explanation:

Errors:

1. The main method had a semi colon after it. This is wrong

2. An open brace was supposed to follow the main method

3. The declaration of the variables was supposed to end with a semi colon

4. the correct comment style is // and not \\

5. Initialization of variables was supposed to end with semi colons

6. The output statement had C and not c which is the declared and initialized variable..Java is strictly typed

7. Open and closing braces for the class and method wrongly placed

6 0
3 years ago
Other questions:
  • When a browser makes a request for a static web page, the web server a. finds the HTML for the page and renders it b. renders th
    11·1 answer
  • Which version of Windows was considered an operating environment rather than an operating system? Windows 1.0 Windows 3.0 Window
    9·1 answer
  • Which statements describe the use of styles in Word? Check all that apply.
    11·2 answers
  • A website's ____ page provides basic information about the individual or organization and includes a navigation bar with links t
    13·1 answer
  • What is the process for creating a new merge document for address labels?
    10·2 answers
  • To print a budget:________.
    9·1 answer
  • A tornado destroyed many
    6·2 answers
  • The _____ component of a decision support system (DSS) includes mathematical and statistical models that, along with the databas
    14·1 answer
  • What's the smallest part of a computer
    8·2 answers
  • Which of the following should be clicked to open Backstage View?
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!