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[1000],i,n,t1,t2;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
t1=0;
t2=1;
for (i=1; i<=n; i++)
{
if (a[i]%2!=0) t1+=a[i];
else t2*=a[i];
}
cout<<t1<<endl;
cout<<t2<<endl;
return 0;
}
uses crt;
var i,n,t,j,kt:integer;
begin
clrscr;
readln(n);
t:=0;
for i:=2 to n do
if n mod i=0 then
begin
kt:=0;
for j:=2 to trunc(sqrt(i)) do
if i mod j=0 then kt:=1;
if kt=0 then t:=t+i;
end;
write(t);
readln;
end.
uses crt;
var n,t:integer;
{------------------kiem-tra-so-nguyen-to----------------------------}
function ktnt(x:integer):boolean;
var i:integer;
kt:boolean;
begin
kt:=true;
for i:=2 to trunc(sqrt(x)) do
if x mod i=0 then
begin
kt:=false;
break;
end;
if kt=true then ktnt:=true
else ktnt:=false;
{----------------------chuong-trinh-chinh------------------------}
begin
clrscr;
t:=0;
repeat
write('Nhap n='); readln(n);
if (n mod 2=0) then t:=t+n;
until ktnt(n)=false;
writeln(t);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long n,i,dem,t;
int main()
{
cin>>n;
dem=0;
t=0;
for (i=1; i<=n;i++)
if (n%i==0)
{
dem++;
t=t+i;
}
cout<<dem<<" "<<t;
return 0;
}
Program HOC24;
var i: integer;
function nt(x: integer): boolean;
var j: integer;
begin
nt:=true;
if (x=2) or (x=3) then exit;
nt:=false;
if (x=1) or (x mod 2=0) or (x mod 3=0) then exit;
j:=5;
while j<=trunc(sqrt(x)) do
begin
if (x mod j=0) or (x mod (j+2)=0) then exit;
j:=j+6;
end;
nt:=true;
end;
Begin
for i:= 10 to 99 do if nt(i) and i mod 2=0 then write(i,' ');
readln
end.
a: #include <bits/stdc++.h>
using namespace std;
unsigned long long int n,i,t1,t2,x;
int main()
{
cin>>n;
t1=0;
t2=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%2==0) t1=t1+x;
else t2=t2+x;
}
cout<<t1<<endl;
cout<<t2;
return 0;
}