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;
i,n,t,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
dem:=0;
for i:=1 to n do
if a[i] mod 2=0 then
begin
t:=t+a[i];
inc(dem);
end;
writeln('Tong cac so chan la: ',t);
writeln('So luong so chan la: ',dem);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a[20],b[20],c[20],i,n;
int main()
{
cin>>n;
srand(time(NULL));
for (i=1; i<=n; i++)
a[i]=rand();
srand(time(NULL));
for (i=1; i<=n; i++)
b[i]=rand();
for (i=1; i<=n; i++)
c[i]=abs(a[i]-b[i]);
for (i=1; i<=n; i++) cout<<a[i]<<" "; cout<<endl;
for (i=1; i<=n; i++) cout<<b[i]<<" "; cout<<endl;
for (i=1; i<=n; i++) cout<<c[i]<<" "; cout<<endl;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[10000],n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n; i++)
{
cin>>a[i];
t=t+a[i];
}
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
dem=0;
for (i=1; i<=n; i++)
if (a[i] %2==0) dem++;
cout<<dem<<endl;
cout<<t;
return 0;
}
uses crt;
var a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
writeln(a[3]);
readln;
end.
uses crt;
var n,i:integer;
a:array[1..10]of integer;
begin
clrscr;
readln(n);
for i:=1 to n do
readln(a[i]);
for i:=1 to n do
write(a[i]:4);
readln;
end,
#include <bits/stdc++.h>
using namespace std;
long long b[20],i,n;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>b[i];
for (i=1; i<=n; i++)
{
if ((b[i]%2!=0) or (i%2==0)) cout<<b[i]<<" ";
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[200],i,n,k;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
cin>>k;
kt=false;
for (i=1; i<=n; i++)
if (a[i]==k)
{
cout<<i<<" ";
kt=true;
}
cout<<endl;
if (kt==false) cout<<"Khong co so k trong day"<<endl;
sort(a+1,a+n+1);
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 a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
randomize;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
a[i]:=random(100);
end;
for i:=1 to n do
write(a[i]:4);
readln;
end.