Главная » 2017 » Октябрь » 23 » 3_22
09:05
3_22

#include <iostream>
using namespace std;
int main()
{
    setlocale(LC_ALL,"rus_rus.1251");
    int n,s=0,p=1,k=0,a;
    cout<<"Введите N -> ";
    cin>>n;
    for (int i=1;i<=n;i++)
    {
        cout<<"Введите число -> "; 
        cin>>a;
        if (a>0) s+=a;
        if (a<0) p*=a;
        if (a%2==0) k+=1;
    }
    cout<<"Сумма положительных = "<<s<<endl;
    cout<<"Произведение отрицательных = "<<p<<endl;
    cout<<"Количество чётных = "<<k<<endl;
    system("pause");
    return 0;
}

Просмотров: 303 | Добавил: denjes | Рейтинг: 0.0/0
Всего комментариев: 0
avatar