Write a program to input a sequence of 8 integers, count all the odd numbers and sum all the negative integers. One integer is input and processed each time around the loop.
Python Programming
oddCount = 0 sumNegatives = 0 for i in range(8): n = int(input("Enter number: ")) if n%2==0: oddCount += 1 if n<0: sumNegatives += n print("count of all the odd numbers:",oddCount) print("sum of all the negative integers:",sumNegatives)
Get Answers For Free
Most questions answered within 1 hours.