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 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.
#include <bits/stdc++.h>
using namespace std;
long long b[15],i,n,k,dem;
bool kt;
int main()
{
n=15;
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=false;
for (i=1; i<=n; i++) if (b[i]==k)
{
cout<<i<<" ";
kt=true;
}
if (kt==false) cout<<"Khong co k trong day";
else cout<<endl;
sort(b+1,b+n+1);
for (i=1; i<=n; i++) cout<<b[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;
}
phần đọc tự viết
for i:=j to n do
b[i+1]:=a[i];
for i:=1 to j do write(g,a[i]);
write(g,M);
for i:=j+1 to n+1 do
write(g,b[i]);
uses crt;
var a,b:array[1..100]of integer;
i,n,m,k,tam:integer;
begin
clrscr;
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(a[i]:6);
writeln;
write('Nhap m='); readln(m);
write('Nhap chi so k='); readln(k);
for i:=1 to k do
b[i]:=a[i];
for i:=k+2 to n+1 do
b[i]:=a[i-1];
b[k+1]:=m;
for i:=1 to n+1 do
write(b[i]:6);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a[10000],i,n;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
t=0;
for (i=1; i<=n; i++) if (a[i]%2==0) t+=a[i];
cout<<"Tong cac so chan la: "<<t<<endl;
sort(a+1,a+n+1);
cout<<"Day so giam dan la: ";
for (i=n; i>=1; i--) cout<<a[i]<<" ";
return 0;
}
uses crt;
var a:array[1..100]of integer;
i,n,t,j,tam:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
for i:=1 to n do write(a[i]:5);
writeln;
writeln('Cac so duong la: ');
for i:=1 to n do if (a[i]>0) then write(a[i]:4);
writeln;
t:=0;
for i:=1 to n do
if a[i] mod 3=0 then t:=t+a[i];
writeln(t);
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(a[i]:4);
readln;
end.
Bài 2:
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n,ln,nn;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
ln=a[1];
nn=a[1];
for (i=2; i<=n; i++)
{
ln=max(ln,a[i]);
nn=min(nn,a[i]);
}
cout<<ln<<" "<<nn;
}
#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;
}
e cảm ơn nhưng a ơi cái e cần là pascal ý ạ