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.
Program HOC24;
var d,i,n: integer;
a: array[1..1000] of integer;
t: longint;
function nt(x: longint): boolean;
var j: longint;
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
write('Nhap N: '); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
d:=0; t:=0;
for i:=1 to n do
if nt(a[i]) then
begin
d:=d+1;
t:=t+a[i];
end;
writeln('Co ',d,' so nguyen to trong day');
write('Tong cac so nguyen to trong day la: ',t);
readln
end.
uses crt;
var a:array[1..1000]of integer;
i,n,dem,t,j,kt:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
t:=0;
for i:=1 to n do
if a[i]>1 then
begin
kt:=0;
for j:=2 to a[i]-1 do
if a[i] mod j=0 then kt:=1;
if kt=0 then
begin
inc(dem);
t:=t+a[i];
end;
end;
writeln('So luong so nguyen to la: ',dem);
writeln('Tong cac so nguyen to la: ',t);
readln;
end.
mình ghi dư cái số 4 bên phần BAI7.INP nha mn
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll i, j, n, a[1000005], dem = 0, m;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for (i = 1; i <= n; i++)
{
cin >> a[i];
if (a[i] % 3 == 0)
{
n--;
i--;
}
}
for (i = 1; i <= n; i++)
{
cout << a[i] << " ";
}
cout<<endl;
for(i=1;i<=n;i++)
{
if(a[i]%5==0)
{
for(j=i;j<=n;j++)
{
a[j]=a[j+1];
}
n--;
i--;
}
}
for(i=1;i<=n;i++)
{
cout<<a[i]<<" ";
}
return 0;
}
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 then t:=t+a[i];
writeln(t);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long n,a[1000],m,i;
bool kt;
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
cin>>m;
kt=false;
for (i=1; i<=n; i++)
if (a[i]==m) kt=true;
if (kt==true) cout<<"Co";
else cout<<"Khong";
return 0;
}
var a:array [1..100] of integer;
i,n,dem:integer;
begin
write('Nhap so luong so N = ');readln(n);
for i:=1 to n do
begin
write('Nhap vao so thu ',i,': ');readln(a[i]);
if a[i] mod 3 = 0 then dem:=dem+1;
end;
write('Co ',dem,' so chia het cho 3');
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n,dem;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
dem=0;
for (i=1; i<=n; i++)
if (a[i]%3==0) dem++;
cout<<dem;
return 0;
}
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 then t:=t+a[i];
writeln(t);
readln;
end.