Ответ:
include <bits/stdc++.h>
using namespace std;
int k[10010],nom[10010];
int main()
{
int s=0,r,n;
cin>>n;
for(int i=1;i<=n;i++)
cin>>k[i];
if(k[i]>0)s=s+k[i];
if(k[i]%2==0)r++;
}
cout<<s<<' '<<k<<' ';
for(int i=1;;i<=n;i++)
if(k[i]<0)cout<<nom[i];
return 0;
#include <iostream>
#include <vector>
int main(){
int n,b,count = 0,sum = 0;
cin >> n;
vector <int> a;
for(int i = 0; i < n; i++){
cin >> b;
a.push_back(b);
for(int i = 0; i< n; i++){
if(a[i] > 0){
sum += a[i];
if(a[i] % 2 == 0){
count++;
cout << "Sum: " << sum << endl <<"Kolichestvo chisel kotorye delyatsya na 2: "<< count << endl;
cout << "Nomera otricatelnyh chisel: ";
if(a[i] < 0){
cout << i << " ";
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
include <bits/stdc++.h>
using namespace std;
int k[10010],nom[10010];
int main()
{
int s=0,r,n;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>k[i];
if(k[i]>0)s=s+k[i];
if(k[i]%2==0)r++;
}
cout<<s<<' '<<k<<' ';
for(int i=1;;i<=n;i++)
{
if(k[i]<0)cout<<nom[i];
}
return 0;
}
Ответ:
#include <iostream>
#include <vector>
using namespace std;
int main(){
int n,b,count = 0,sum = 0;
cin >> n;
vector <int> a;
for(int i = 0; i < n; i++){
cin >> b;
a.push_back(b);
}
for(int i = 0; i< n; i++){
if(a[i] > 0){
sum += a[i];
}
if(a[i] % 2 == 0){
count++;
}
}
cout << "Sum: " << sum << endl <<"Kolichestvo chisel kotorye delyatsya na 2: "<< count << endl;
cout << "Nomera otricatelnyh chisel: ";
for(int i = 0; i < n; i++){
if(a[i] < 0){
cout << i << " ";
}
}
return 0;
}