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
Natali5045456 [20]
4 years ago
10

For a list of numbers entered by the user and terminated by 0. Write a program to find the sum of the positive numbers and the s

um of the negative numbers. (Hint: This is similar to an example in this chapter. Be sure to notice that the example given in this chapter counts the number of positive and negative numbers entered, but this problem asks you to find the sums of the positive and negative numbers entered Use Raptor in a reverse loop logic with no on left and yes on right.)
Computers and Technology
1 answer:
Mumz [18]4 years ago
6 0

Answer:

Following are the program in the Python Programming Language

#set variables to 0

positive_sum=0

negative_sum=0

#print message

print("Enter 0 to terminate")

#set the while loop

while(True):

 #get input from the user

 num=float(input("Enter positive or negative numbers: "))

 #set if statement to check condition

 if(num==0):

   break

 elif(num>0):

   positive_sum+=num

 else:

   negative_sum+=num

#print output with message

print()

print("sum of positive numbers: ", positive_sum)

print("sum of negative numbers: ", negative_sum)

<u>Output:</u>

Enter 0 to terminate

Enter positive or negative numbers: 1

Enter positive or negative numbers: 3

Enter positive or negative numbers: 5

Enter positive or negative numbers: -7

Enter positive or negative numbers: -2Enter positive or negative numbers: 0

sum of positive numbers:  9.0

sum of negative numbers:  -9.0

Explanation:

Here, we set two integer data type variables "positive_sum", "negative_sum" and initialize to 0.

Then, we set the while infinite loop inside the loop.

  • Set a variable "num" and get input from the user in it.
  • Set the if conditional statement and check condition the variable "num" is equal to 0 then, loop will terminate.
  • Set the elif statement and check condition the variable "num" is greater than 0 then, add that input and store in the variable "positive_sum"
  • Otherwise, add that input and store in the variable "negative_sum".

Finally, we print the output with the message.

You might be interested in
What is the cffa act
garri49 [273]

CFAA is an acronym that stands for Computer Fraud and Abuse Act. It is an anti-hacking bill that was passed to amend an existing computer fraud law. It aims to strengthen cyber security by forbidding access to computers without authorization.

3 0
3 years ago
Read 2 more answers
Choose the appropriate computing generation.
tia_tia [17]

Answer:

5th generation : artificial intelligence

3rd generation: integrated circuits

4th generation : microprocessors

5th generation: parallel processing

<em>hope this helps!</em>

5 0
3 years ago
Read 2 more answers
WHAT ACTIONS CAUSE SPAM ON LINKEDIN?
klio [65]

Answer:

LinkedIn has a very smart algorithm, and it has a very strict policy against spammers. Back in 2014, it deleted millions of accounts that were causing spam on LinkedIn.  

Spam occurs:  

1. When you send bulk of connect requests in a short time  

2. When you send irrelevant messages to prospects  

3. When you Perform overactivity  

4. When you use LinkedIn automation tools  

5. When you send spammy and sales-y messages  

All these actions cause spam on LinkedIn, and it immediately takes action against you by restricting your account temporarily or permanently.

4 0
3 years ago
How to write conclusion of hard disk​
sergeinik [125]

Answer:

el disco duro es un componte de almacenamiento de una pc, su uso es de guardar archivos también como el sistema operativo de ejemplo :linux, window ,mac etc

Explanation:

7 0
3 years ago
a problem exists when the current condition differs from a desired condition. This idea defines which step in problem-solving?
zhannawk [14.2K]

In algorithm the idea defines a decision box

5 0
3 years ago
Read 2 more answers
Other questions:
  • You are using a crimper to attach an RJ-45 connector to a Cat 6 UTP cable. You need to use the T568A standard to connect the ind
    6·1 answer
  • Is a fundamental building block of a relational database because this object stores all of the data
    15·1 answer
  • Communications technology and the Internet can be used to reduce the time and costs involved in disseminating financial statemen
    14·1 answer
  • What is thhe name of service included with windows server operating systemthat manages a centralized database containing user ac
    5·1 answer
  • Advantages and disadvantages of technology
    13·1 answer
  • A social cause is: O A. when one person protests without the support of others. B. something that not many citizens think or car
    8·1 answer
  • How to use access?<br> like working in access and bringing tables and stuff
    5·1 answer
  • Choose all that apply.
    5·2 answers
  • Type the correct answer in the box. Spell all words correctly.
    13·1 answer
  • An excerpt of a sample business cover letter. The text uses curly font and has a warm to cold color background. What change does
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!