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 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;
}
6:
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,A[100],i,dem=0;
cin>>n;
for (int i=1; i<=n; i++) cin>>A[i];
for (int i=1;i<=n; i++)
if (A[i]%2!=0) dem++;
cout<<dem;
return 0;
}
5:
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n,nn=1e6,A[1000];
cin>>n;
for (int i=1; i<=n; i++) cin>>A[i];
for (int i=1; i<=n; i++)
nn=min(nn,A[i]);
for (int i=1; i<=n; i++)
if (nn==A[i]) cout<<i<<" ";
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.
#include <bits/stdc++.h>
using namespace std;
long long b[5],i,n,k,dem,kt;
int main()
{
n=5;
for (i=1; i<=n; i++) cin>>b[i];
for (i=1; i<=n; i++) cout<<b[i]<<" ";
cout<<endl;
dem=0;
for (i=1; i<=n; i++) if (b[i]%2==0) dem++;
cout<<"So so chan la: "<<dem<<endl;
cin>>k;
kt=0;
for (i=1; i<=n; i++) if (b[i]==k)
{
cout<<i<<" ";
kt=1;
}
if (kt==0) cout<<"Khong co k trong day";
sort(b+1,b+n+1);
for (i=1; i<=n; i++) cout<<b[i]<<" ";
return 0;
}
uses crt;
var a:array[1..20]of integer;
i,n,t,dem:integer;
begin
clrscr;
for i:=1 to 20 do
begin
repeat
write('A[',i,']='); readln(a[i]);
until a[i]>0;
end;
t:=0;
for i:=1 to 20 do
t:=t+a[i];
writeln('Tong cac so trong mang la: ',t);
dem:=0;
for i:=1 to 20 do
if a[i] mod 2=0 then inc(dem);
writeln('Trong mang co ',dem,' so chan');
readln;
end.
uses crt;
var b:array[1..5]of integer;
i,n,dem,k,tam,j:integer;
kt:boolean;
begin
clrscr;
n:=5;
for i:=1 to n do readln(b[i]);
for i:=1 to n do write(b[i]:4);
writeln;
dem:=0;
for i:=1 to n do if b[i] mod 2=0 then dem:=dem+1;
writeln('So luong so chan la: ',dem);
readln(k);
kt:=false;
for i:=1 to n do
if b[i]=k then
begin
write(i:4);
kt:=true;
end;
if (kt==false) then writeln('Khong co k trong day')
else writeln;
for i:=1 to n-1 do
for j:=i+1 to n do
if b[i]>b[j] then
begin
tam:=b[i];
b[i]:=b[j];
b[j]:=tam;
end;
for i:=1 to n do write(b[i]:4);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
for i:=1 to n do
if a[i] mod 2=0 then inc(dem);
writeln(dem);
readln;
end.