K
Khách

Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.

#include <bits/stdc++.h>

using namespace std;

long long a[10000],i,n,t1,t2,dem1,dem2;

int main()

{

cin>>n;

for (i=1; i<=n; i++)

cin>>a[i];

dem1=0;

dem2=0;

t1=0;

t2=0;

for (i=1; i<=n; i++)

{

if (a[i]>0)

{

dem1++;

t1+=a[i];

}

if (a[i]<0)

{

dem2++;

t2+=a[i];

}

}

long long t3=0;

for (i=1; i<=n; i++)

if (i%2==1) t3+=a[i];

long long t4=0;

for (i=1; i<=n; i++)

if (i%2==1 && a[i]%2==0) t4+=a[i];

 cout<<t1<<" "<<t2<<endl;

cout<<dem1<<" "<<dem2<<endl;

cout<<t3<<endl;

cout<<t4<<endl;

for (i=1; i<=n; i++)

if (a[i]%3==0) cout<<a[i]<<" ";

return 0;

}

12 tháng 4 2022

bạn viết rõ ra được không ạ. mình không hiểu

Câu 1: A

Câu 2: Không có câu nào đúng

29 tháng 3 2022

A

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i,t,dem,s;

int main()

{

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

t=0;

dem=0;

s=1;

for (i=1; i<=n; i++)

{

if (a[i]%2==0) t+=a[i];

if (a[i]%5==2) dem++;

if (a[i]%7==3) s*=a[i];

}

cout<<t<<endl;

cout<<dem<<endl;

cout<<s;

return 0;

}

 

 

 

 

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i,t,dem,s;

int main()

{

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

t=0;

dem=0;

s=1;

for (i=1; i<=n; i++)

{

if (a[i]%2==0) t+=a[i];

if (a[i]%5==2) dem++;

if (a[i]%7==3) s*=a[i];

}

cout<<t<<endl;

cout<<dem<<endl;

cout<<s;

return 0;

}

 

#include <bits/stdc++.h>

using namespace std;

string st;

int d,i,dem;

int main()

{

getline(cin,st);

d=st.length();

cout<<d<<endl;

dem=0;

for (i=0; i<d; i++)

if (st[i]=="A")

{

cout<<i<<" ";

dem++;

}

cout<<endl;

cout<<dem;

return 0;

}