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.
Bài 1:
#include <bits/stdc++.h>
using namespace std;
long long x,n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n; i++)
{
cin>>x;
if ((x<0) and (x%2!=0)) t=t+x;
}
cout<<t;
return 0;
}
6:
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,A[100],i,dem=0;
cin>>n;
for (int i=1; i<=n; i++) cin>>A[i];
for (int i=1;i<=n; i++)
if (A[i]%2!=0) dem++;
cout<<dem;
return 0;
}
5:
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n,nn=1e6,A[1000];
cin>>n;
for (int i=1; i<=n; i++) cin>>A[i];
for (int i=1; i<=n; i++)
nn=min(nn,A[i]);
for (int i=1; i<=n; i++)
if (nn==A[i]) cout<<i<<" ";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long x,n,i,t,dem;
int main()
{
cin>>n;
dem=0;
t=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%2==0 && x>10) t+=x;
if (x%2!=0 || x<100) dem++;
}
cout<<t<<" "<<dem;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[10000],n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n; i++)
{
cin>>a[i];
t=t+a[i];
}
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
dem=0;
for (i=1; i<=n; i++)
if (a[i] %2==0) dem++;
cout<<dem<<endl;
cout<<t;
return 0;
}
uses crt;
var a:array[1..10]of integer;
i,t:integer;
begin
for i:=1 to 10 do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to 10 do
t:=t+a[i];
writeln('Tong cua day la: ',t);
writeln('Trung binh cong cua day la: ',t/n:4:2);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n,t,dem;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
dem=0;
t=0;
for (i=1; i<=n; i++)
if (a[i]>0)
{
dem++;
t=t+sqrt(a[i]);
}
cout<<t;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long x,n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n; i++)
{
cin>>x;
if ((x<0) and (x%2==0)) t=t+x;
}
cout<<t;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long n,i,a[1000],t,dem,t1;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++)
if (a[i]%2==0) cout<<a[i]<<" ";
cout<<endl;
t=0;
dem=0;
for (i=1; i<=n; i++)
if (a[i]%2==0)
{
t=t+a[i];
dem++;
}
cout<<fixed<<setprecision(2)<<(t*1.0)/(dem*1.0)<<endl;
t1=0;
for (i=1; i<=n; i++)
if (a[i]%2!=0 || a[i]%3==0) t1+=a[i];
cout<<t1;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[15],i,n=15,s,t;
int main()
{
for (i=1; i<=n; i++) cin>>a[i];
s=1;
for (i=1; i<=n; i++)
if (a[i]%2==0)
{
cout<<a[i]<<" ";
s*=a[i];
}
cout<<endl;
cout<<"Tich cac so chan la: "<<s<<endl;
t=0;
for (i=1; i<=n; i++)
if (a[i]<0) t=t+a[i]*a[i];
cout<<t;
return 0;
}