Odd Numbers
Time limit1sMemory limit128 MB
Given seven natural numbers, print the sum of the odd ones and the smallest odd one, or -1 if none exist.
- Level
Easy1 of 10
- Topics
- Array, Implementation
- Solved
- No attempts yet
Problem
Seven natural numbers are given. Select only the odd numbers, compute their sum, and find the smallest selected odd number.
Input
One natural number is given on each of the first through seventh lines. Each number is less than 100.
Output
If there is no odd number, print -1. Otherwise, print the sum of the odd numbers on the first line and the smallest odd number on the second line.