Advertisement
STANAANDREY

9bac 46

Jan 21st, 2019
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7. unsigned x,S,nrp,n;
  8. float ma;
  9.  
  10. cin>>x;
  11. if (x%2==0)
  12. {
  13.     S=x;
  14.     nrp=1;
  15. }
  16. else
  17. {
  18.     S=0;nrp=0;
  19. }
  20. do
  21. {
  22.     cin>>n;
  23.     if (n%2==0)
  24.     {
  25.         S+=n;
  26.         nrp++;
  27.     }
  28.  
  29. }while (n!=x);
  30. ma=(float)S/(float)nrp;
  31. cout<<ma<<" "<<nrp;
  32.  return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement