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
tresset_1 [31]
2 years ago
10

Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive.

After the loop terminates, it prints out, on a single line and separated by a single space, the sum of all the even integers read and the sum of all the odd integers read. python
Computers and Technology
1 answer:
Paraphin [41]2 years ago
3 0

Answer:

The program to this question as follows:

Program:

#defining variable and assign value

odd=0  

even=0  

i=1  

print('Input 0 after inserting all number: ') #print message

while i>0: #define loop for check inserting and add all number

   i=int(input()) #input value by user end

   if (i< 0): #check value is not positive

       break

   if ((i % 2)==0and(i>0)): #check even number condition

       even=even+i #add even numbers

   if ((i % 2)!=0and(i>0)): #check odd number condition

       odd=odd+i #add odd numbers

print ('Sum of Even number:',even,'and','Sum of Odd number:',odd) #print value

Output:

Input 0 after inserting all number:  

1

2

3

5

7

0

Sum of Even number: 2 and Sum of Odd number: 16

 Explanation:

In the above python program, three variable is defined, that is "even, odd and i", in which "even and odd" variable assign value that is "0", and the variable i is used for inserting elements from user. In the next line a while loop is defined that inserts numbers in variable "i", in this loop, 3 if block is used that can be defined as follows:

  • In first if block variable "i", checks that value is non-positive number if this condition is true, it will break the loop.
  • In second if block this block check even number condition and add in even variable.
  • In third, if block this block check odd number condition and add in odd variable.  

End of the loop we use print function that prints the sum of even numbers and odd numbers.

You might be interested in
Friday Night Funkin Fans, does this count as a leak if I share it?
Aliun [14]
Hmm no I don’t think so
7 0
2 years ago
Read 2 more answers
When you use the bufferedreader class, you must import the ____ package into your program?
BigorU [14]
When you use the bufferedreader class, you must import the java.io package into your program.  It is<span> an API that comes with </span>Java<span> which is aimed at reading and writing data (input and output). ... For instance, read data from a file and write to a file or write a response back over the network. The </span>Java IO<span> API is located in the </span>Java IO<span> package ( </span>java.io<span> ).</span>
5 0
3 years ago
What type of camera is a cell phone camera
Sergeeva-Olga [200]

Answer:

A camera phone is a mobile phone which is able to capture photographs and often record video using one or more built-in digital cameras. It can also send the resulting image over the telephone function. The first commercial camera phone was the Kyocera Visual Phone VP-210, released in Japan in May 1999.

Explanation:

Hope this kinda helps you :)

3 0
3 years ago
Read 2 more answers
Which of the following common software packages would help a business
Jobisdone [24]

Answer:

D. Spreadsheets

Explanation:

While A also seems correct, a spreadsheet is best at collecting and organizing data. Databases would only store data while a spreadsheet would keep those records, as well as help calculate a budget or payroll.

3 0
2 years ago
PowerPoint displays many that are varied and appealing and give you an excellent start at designing a presentation. However, you
Jet001 [13]

Answer:

The answer is themes.

Power point displays many <u>themes</u>

Explanation:

A power point theme is a combination of effects,fonts and colors that can be applied to the presentation.It makes the presentation more attractive and beautiful if used properly and smartly.Power point has built in themes that gives excellent start to your presentation.

5 0
3 years ago
Other questions:
  • 1.using synonyms can help make ur writing more________
    11·1 answer
  • Why is a DNS cache poisoning attack dangerous? Check all that apply. A. Errrr...it's not actually dangerous. B. It allows an att
    12·1 answer
  • How is the EF​ computed? A. ES​ + Activity time B. LF minusActivity time C. ​Min{LS of all immediate following​ activities} D. ​
    11·1 answer
  • What are the correct answers?
    11·1 answer
  • Kenny FRIEND ME. Ps that is my brother
    9·2 answers
  • Suppose cell C5 contains the formula =B$6+C1.
    6·1 answer
  • Which storage is faster than secondary storage​
    14·2 answers
  • Out put of Print (3**2*2)
    13·2 answers
  • Define a python functions that draw a pinwheel using the pinwheel function that has input paramiters that allows you to change t
    15·1 answer
  • If you give someone ______ to your device, they can control it through another phone or computer.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!