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 x,i,n,t,dem;
int main()
{
cin>>n;
t=0;
dem=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%2==0)
{
dem++;
t=t+x;
}
cout<<t<<" "<<dem;
return 0;
}
}
uses crt;
var C : array [1 .. 50] of integer;
i, n : integer;
begin
clrscr;
write('Nhap so phan tu : '); readln(n);
write('Nhap day gom ', n ,' so : ');
for i := 1 to n do read(C[i]);
write('Cac gia tri chan : ');
for i := 1 to n do
if C[i] mod 2 = 0 then write(C[i], ' ');
readln
end.
uses crt;
var a:array[1..100]of integer;
i:integer;
begin
clrscr;
for i:=1 to 100 do
begin
repeat
write('A[',i,']='); readln(a[i]);
until a[i]>0;
end;
for i:=1 to n do
write(a[i]:4);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a[100],n,i,t,t1,dem,dem1;
//chuongtrinhcon
bool ktnt(long long x)
{
if (x<=1) return(false);
for (int i=2; i*i<=x; i++)
if (x%i==0) return(false);
return true;
}
//chuongtrinhchinh
int main()
{
cin>>n;
for (i=1; i<=n; i++)
{
cin>>a[i];
}
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
t=0;
for (i=1; i<=n; i++) if (a[i]%2==0) t=t+a[i];
cout<<t<<endl;
dem=0;
for (i=1; i<=n; i++) if (a[i]%3==0) dem++;
cout<<dem<<" ";
t1=0;
dem1=0;
for (i=1; i<=n; i++)
if (a[i]%2!=0)
{
t1+=a[i];
dem1++;
}
cout<<fixed<<setprecision(2)<<(t1*1.0)/(dem1*1.0)<<endl;
for (i=1; i<=n; i++)
if (ktnt(a[i])==true) cout<<a[i]<<" ";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[10],i;
int main()
{
for (i=1; i<=10; i++)
cin>>a[i];
for (i=1; i<=10; i++)
cout<<a[i]<<" ";
cout<<endl;
for (i=1; i<=10; i++)
if (a[i]%2==0) cout<<a[i]<<" ";
return 0;
}
uses crt;
var A : array [1 .. 10] of integer;
i : integer;
begin
clrscr;
for i := 1 to 10 do
begin
write('Nhap so thu ', i ,' : ');
readln(A[i]);
end;
write('Cac gia tri chan : ');
for i := 1 to 10 do
if A[i] mod 2 = 0 then
write(A[i], ' ');
readln
end.
Program BTT;
Uses crt;
Var A: array[1..100] of qword;
i,d: byte;
Begin
Clrscr;
d:=0;
For i:=1 to 100 do
Begin
Write('A[',i,'] = ');
Readln(A[i]);
If A[i] mod 2 = 0 then inc(d);
End;
Write('Mang vua nhap: ');
For i:=1 to 100 do Write(A[i],' ');
Writeln;
Write('Co ',d,' so chan');
Readln
End.
uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
for i:=1 to n do write(a[i]:4);
writeln;
t:=0;
for i:=1 to n do
if a[i] mod 2=0 then t:=t+a[i];
writeln(t);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long n,i,a[10000];
int main()
{
cin>>n;
for (i=1; i<=n; i++)
cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long x,i,n=4,dem;
int main()
{
dem=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%2==0) dem++;
}
cout<<dem;
return 0;
}