Laitofai

6

Dec 18th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.24 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     double n, counter=0, sum=0;
  8.     do{
  9.         cin>>n;
  10.         if(n>=0){
  11.             counter++;
  12.             sum+=n;}
  13.     }while(n>=0);
  14.     cout<<sum/counter;
  15.     return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment