Sum of Even Numbers in a List
A stationery wholesaler sells pens in sealed pairs and can only fill an order out of whole pairs. So an order for an even number of pens ships in full, and an order for an odd number is rejected outright and contributes nothing to the van. A number is even when it splits into two equal whole halves with nothing left over.
Task: Print the total number of pens actually going out today.
Input
A single line holding between 1 and 1000 integers separated by single spaces. Each is one shop's order, and is 0 or greater.
Output
One line holding a single integer — the total across the orders that can be filled. If not one order on the line can be filled, the line must still be printed, holding 0.
Example:
Input:
1 2 3 4 5 6
Output:
12
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in