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.
uses crt;
var a:array[1..100]of integer;
n,i,t,nn,kt:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
t:=1;
for i:=1 to n do
if a[i] mod 3=0 then t:=t*a[i];
writeln(t);
kt:=0;
nn:=32567;
for i:=1 to n do
if a[i] mod 3=0 then
begin
if nn>a[i] then nn:=a[i];
kt:=1;
end;
if kt=0 then writeln('Khong co so chia het cho 3')
else writeln('So nho nhat chia het cho 3 la: ',nn);
for i:=1 to n do
if nn=a[i] then write(i:4);
writeln;
for i:=n downto 1 do
write(a[i]:4);
readln;
end.
uses crt;
var n,k,i,t:integer;
a:array[1..100]of integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Nhap k='); readln(k);
t:=0;
for i:=1 to n do
if a[i] mod k=0 then t:=t+a[i];
writeln('Tong cac so chia het cho ',k,' trong day la: ',t);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
if (a[i] mod 2=0) and (a[i] mod 3=0) then t:=t+a[i];
writeln(t);
readln;
end.
uses crt;
var i,t:integer;
begin
clrscr;
t:=0;
for i:=1 to 100 do
if i mod 5<>0 then t:=t+i;
writeln(t);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b,k;
cin>>a>>b>>k;
for (int i=a; i<=b; i++)
if (i%k==0) cout<<i<<" ";
return 0;
}
uses crt;
var a:array[1..100]of integer;
i,n,k,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Nhap k='); readln(k);
t:=0;
for i:=1 to n do
if a[i] mod k=0 then t:=t+a[i];
writeln(t);
readln;
end.
Var i,n:integer;
s:longint;
Begin
Write('n = ');readln(n);
For i:=1 to n-1 do
If (i mod 2 = 0) and (i mod 3 = 0) then
s:=s + i;
Write('Tong la ',s);
Readln;
End.
#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;
}
Khóc huhu :((
#include <bits/stdc++.h>
using namespace std;
long long i,n,a[1000],dem,t;
int main()
{
cin>>n;
for (i=1; i<=n; i++)
cin>>a[i];
t=0;
for (i=1; i<=n; i++)
if (a[i]%15==0)
{
cout<<a[i]<<" ";
t+=a[i];
}
cout<<endl;
cout<<"Tong cac so chia het cho 3 va 5 la: "<<t;
return 0;
}