Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- #include<fstream>
- using namespace std;
- int main()
- {
- ifstream in("input.txt");
- ofstream out("output.txt");
- int a[100];
- int n,m=0;
- float sum=0;
- in >> n;
- for (int i = 0; i < n;i++)
- {
- {in >> a[i];
- if (a[i] < 0) {
- sum += a[i];
- m++;
- }
- }
- }
- sum /= m;
- out << sum<< endl;
- in.close();
- out.close();
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement