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.
Đề 3:
Câu 2:
#include <bits/stdc++.h>
using namaspace std;
long long x,n,i,dem;
int main()
{
cin>>n;
dem=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%2==0 && i%2!=0) dem++;
}
cout<<dem;
return 0;
}
đề 1
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long n,i,x,ans=0,cnt3=0,cnt5=0;
cin>>n;
for(i=0;i<n;i++)
{
cin>>x;
if(x%3==0)
cnt3++;
if(x%5==0)
cnt5++;
}
cout<<"so luong phan tu chia het cho 3 la: "<<cnt3;
cout<<"\nso luong phan tu chia het cho 5 la: "<<cnt5;
return 0;
}
Program HOC24;
var a: array[1..32000] of integer;
ucln,i,n,ucln1: integer;
function uc(x,y: integer): integer;
var tg: integer;
begin
while y<>0 do
begin
tg:=x mod y;
x:=y;
y:=tg;
end;
uc:=x;
end;
begin
write('Nhap N: '); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
ucln1:=uc(a[1],a[2]);
for i:=3 to n do ucln:=uc(ucln1,a[i]);
write('Uoc chung lon nhat cua day so la: ',ucln);
readln
end.
#include <bits/stdc++.h>
using namespace std;
long long a[10000],n,i;
int main()
{
freopen("bai2.inp","r",stdin);
freopen("bai2.out","w",stdout);
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=n; i>=1; i--) cout<<a[i]<<" ";
return 0;
}
Câu 3:
#include <bits/stdc++.h>
using namespace std;
long long a;
int main()
{
cin>>a;
if (a%2==0) cout<<"La so chan";
else cout<<"La so le";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long n,i,k,x,a[1000];
int main()
{
cin>>n>>k;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++)
if (a[i]==k)
{
cout<<"YES";
return 0;
}
cout<<"NO";
return 0;
}
Câu 1:
const fi='dulieu.dat';
fo='thaythe.out';
var f1,f2:text;
a:array[1..100]of string;
n,d,i,vt:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
n:=0;
while not eof(f1) do
begin
n:=n+1;
readln(f1,a[n]);
end;
for i:=1 to n do
begin
d:=length(a[i]);
vt:=pos('anh',a[i]);
while vt<>0 do
begin
delete(a[i],vt,3);
insert('em',a[i],vt);
vt:=pos('anh',a[i]);
end;
end;
for i:=1 to n do
writeln(f2,a[i]);
close(f1);
close(f2);
end.
Câu 2:
uses crt;
const fi='mang.inp';
fo='sapxep.out';
var f1,f2:text;
a:array[1..100]of integer;
i,n,tam,j:integer;
begin
clrscr;
assign(f1,fi); rewrite(f1);
assign(f2,fo); rewrite(f2);
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
write(f1,a[i]:4);
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]>a[j] then
begin
tam:=a[i];
a[i]:=a[j];
a[j]:=tam;
end;
for i:=1 to n do
write(f2,a[i]:4);
close(f1);
close(f2);
end.
1:
uses crt;
const fi='songuyen.int';
var f1:text;
i,n:integer;
a:array[1..1000]of integer;
begin
clrscr;
assign(f1,fi); rewrite(f1);
readln(n);
for i:=1 to n do readln(a[i]);
for i:=1 to n do write(f1,a[i]:4);
close(f1);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a[10000],i,n;
int main()
{
freopen("bai2.inp","r",stdin);
freopen("bai2.out","w",stdout);
cin>>n;
for (i=1; i<=n; i++)
cin>>a[i];
for (i=1; i<=n; i++)
cout<<a[i]<<" ";
return 0;
return 0;
}