#include <iostream> int main() { int n; std::cin >> n; if (n < 1) { return 0; } int* p=new int[n]; int ret=0; for(int i=0;i<n;i++){ std::cin>>*(p+i); ret+=*(p+i); } std::cout<<ret/n; delete[] p; return 0; }
Test Cases
Test Results
Input
5 10 20 30 40 50
Expected Output
30