Главная »
2020 » Февраль » 14 » Массив. Ввод. Вывод. Обработка
10:47 Массив. Ввод. Вывод. Обработка |
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
const int n=10;
int a[n];
srand(time(0));
cout<<"Vvedite massiv"<<endl;
for (int i=0;i<n;i++) //cin>>a[i];
a[i]=rand()%21-10;
cout<<"Vvedennii massiv"<<endl;
for (int i=0;i<n;i++) cout<<a[i]<<" ";
cout<<endl;
int k=0,s=0,p=1;
for (int i=0;i<n;i++)
{
if (a[i]<0) k++;
if (a[i]>0) s+=a[i];
if (a[i]%5==0) p*=a[i];
}
cout<<"k- ="<<k<<endl;
cout<<"s+ ="<<s<<endl;
cout<<"p kr 5 ="<<p<<endl;
system("pause");
return 0;
}
|
Просмотров: 285 |
Добавил: denjes
| Рейтинг: 0.0/0 |