Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //921. Отрицательные элементы
- //zadacha from e-olimp
- #include<iostream>
- #include<cmath>
- using namespace std;
- int main() {
- int h;
- int sch=0;
- float sum=0;
- cin>>h;
- float mas[h];
- for (int i = 0; i < h; i++)
- {
- cin>>mas[i];
- if (mas[i] < 0) {sch++; sum+=mas[i];}
- }
- cout.setf(ios::fixed);
- cout.precision(2);
- cout<<sch<<" "<<sum<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement