Input: Positive and negative numbers
Output: Display Sum of positive even numbers
N=int(input('Enter the N number: ')) list1=[] print('Enter the numbers: ') for i in range(N): num=int(input()) list1.append(num) sum1=0 for i in range(N): if (list1[i]>0 and list1[i]%2==0): sum1=sum1+list1[i] print("Sum of positive even numbers: {}".format(sum1))
INPUT_1:
Enter the N number: 7
Enter the numbers:
10
-10
20
-20
45
47
-40
Output:
Sum of positive even numbers: 30
INPUT_2:
Enter the N number: 5
Enter the numbers:
10
-10
43
46
46
OUTPUT:
Sum of positive even numbers: 102
exec. on linux terminal
More Codes to Fcuk
- Alphabet pyramid
- Find prime numbers between lower and upper ranges
- Prime Factor
- Find the sum of positive even numbers
- An integer interval [a,b], Find the minimum size of a set S.
- Country A and B, how many years the population of A surpasses B.
- Identify pH level
- Find the Perfect Number
- Find out if a word is a palindrome or not
- Find next Palindrome of N number.
- The writing bot Question. A scientist has created a writing bot. Read and write activity needs to be captured.
- Total Number of Odds in the list
- Partition this string into as many parts as possible.
- Leap year
- LCM of two numbers
- Greatest of three numbers
- Find the Gravitational Force Acting Between Two Objects.
- Find the missing element in geometric progression
- Find the GCD Greatest common divisor
- convert a given float number to integer