tungggg

sochan

Mar 30th, 2022
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3.                               Online C++ Compiler.
  4.                Code, Compile, Run and Debug C++ program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <iostream>
  10.  
  11. using namespace std;
  12.  
  13. int main()
  14. {
  15.     int n;
  16.     cin >> n;
  17.     double s=0 , count =0;
  18.     for (int i=1;i<=n;i++){
  19.         int x;
  20.         cin >> x;
  21.         if ( x%2==0 ){
  22.             s+=x;
  23.             count ++ ;
  24.         }
  25.     }
  26.    
  27.     cout<<"TB cac so chan = "<<s/count;
  28.    
  29.     return 0;
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment