Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main() {
- int n;
- std::cin >> n; /// -> enter the count of n -> numbers
- int sum = 0;
- for(int i = 0; i < n; i++){
- int currentNum;
- std::cin >> currentNum; ///-> reads current num from the console
- if (currentNum >= 4 && currentNum <= 14){
- sum += currentNum;
- }
- }
- std::cout << sum << std::endl; /// -> prints the total sum of numbers
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment