a certain program input ten numbers via keyboard and add up all the numbers less than zero

canadianvice

Honorable
Jul 25, 2012
234
1
10,910
47
Are you looking for code?
(This is in python, but easy to adapt for other languages)
Python:
def sum_below_zero():
    total = 0
    temp_val = 0
    for i in range(10):
        temp_val = int(input("Input a number: "))
        if temp_val < 0:
            total += temp_val
     
    return total
 
Thread starter Similar threads Forum Replies Date
D Apps General Discussion 1
BlueMoon1890 Apps General Discussion 0
Neon The (Anthro) Umbreon Apps General Discussion 1
K Apps General Discussion 2
T Apps General Discussion 10
M Apps General Discussion 2
R Apps General Discussion 3
Y Apps General Discussion 1
I Apps General Discussion 2
S Apps General Discussion 1
S Apps General Discussion 3
Rainfire Apps General Discussion 3
J Apps General Discussion 1
M Apps General Discussion 6
shiftyape Apps General Discussion 3
S Apps General Discussion 4
S Apps General Discussion 6
H Apps General Discussion 1
Samy0806 Apps General Discussion 4
S Apps General Discussion 3
Similar threads
Question Desktop in task manager??????
Question Minecraft causing other programs to lag
Question Documents Folder Is Corrupted And Programs Are Breaking
Solved! Is there a program to clean & organize 1,000’s of saved photos?
video temp files and other types of program questions?
Write a menu driven program which has following options 1. Factorial 2. Prime or not 3. Odd or even. 4. Exit. Once the menu
Solved! free software to limit internet bandwidth of programs
Write a program to calculate commission for the input valu of sales amount
1. Write a program that outputs the greatest common divisor of two positive integers. For example, if you input two positive
How to take user input of one form and assign it to a variable in another form in java?
How to compare user input in a jTextfield with data in the database? (im using java & php)
How do I make a yes or no question with different outcomes depending on input?
I need a program that takes HTML file as input and convert it to hypertree of webOQL type. You may consider a simple HTML file
Write a program that reads 3 integers as input and prints the second largest of these three numbers. Example: Input: 3 4 5 Out
c++ how to advance if dont get input
Wap to input 10 numbers in an array and print the array
Storing the user input without using any predefinedfunctions and reverse the sam
Input to Eliminate Test Scores on Program
How i stop a repetitive structure using keyboard input
How to Read and use the web interface as a input in computer programmi

ASK THE COMMUNITY