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 .. 10] of integer;
i, n, d : integer;
begin
clrscr;
d := 0;
write('Nhap so luong phan tu : '); readln(n);
for i := 1 to n do
begin
write('Nhap so thu ', i ,' : ');
readln(A[i]);
if A[i] mod 2 = 0 then
d := d + 1;
end;
write('Cac phan tu vua nhap : ');
for i := 1 to n do write(A[i],' ');
writeln; write('Day co ', d ,' so chan ');
readln
end.
Program bt;
Uses crt;
Var a:array [1..1000] of integer;
n,i: integer;
Begin
Write( 'Moi nhap n');
Readln(n);
For i: = 1 to n do
Begin
Write( 'a[',i,']');
Readln(a[i]);
End;
For i: = 1 to n do
If a[i] mod 2=0 then write( 'Cac so chan la',a[i]);
Readln;
End.
uses crt;
var A : array [1 .. 10] of integer;
i, n, d : integer;
begin
clrscr;
d := 0;
write('Nhap so luong phan tu : '); readln(n);
for i := 1 to n do
begin
write('Nhap so thu ', i ,' : ');
readln(A[i]);
if A[i] mod 2 = 0 then
d := d + 1;
end;
write('Cac phan tu vua nhap : ');
for i := 1 to n do write(A[i],' ');
writeln; write('Day co ', d ,' so chan ');
readln
end.
uses crt;
var a:array[1..200]of integer;
i,n,max:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
writeln('Gia tri lon nhat la: ',max);
write('Vi tri la: ');
for i:=1 to n do
if max=a[i] then write(i:4);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a[150],i,n;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
sort(a+1,a+n+1);
for (i=1; i<=n; i++) cout<<a[i]<<" ";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n,t;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
t=0;
for (i=1; i<=n; i++) t+=a[i];
cout<<t<<endl;
sort(a+1,a+n+1);
for (i=1; i<=n; i++) cout<<a[i]<<" ";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
double a[100];
int 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;
for (i=1; i<=n; i++)
swap(a[i],a[n+1-i]);
for (i=1; i<=n; i++) cout<<a[i]<<" ";
return 0;
}
bn ơi bn làm bằng pascal đc ko ạ, mik cần cả hai cái lun
uses crt;
var a:array[1..100]of integer;
i,n,dem,k:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Nhap k='); readln(k);
dem:=0;
for i:=1 to n do
if a[i]=k then inc(dem);
writeln('Trong day co ',dem,' phan tu co gia tri bang ',k);
readln;
end.
Bai 2:
uses crt;
var a:array[1..100]of integer;
i,n,t,nn:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
nn:=a[1];
for i:=1 to n do
if nn>a[i] then nn:=a[i];
write(nn);
readln;
end.
uses crt;
var a:array[1..200]of integer;
i,n,j,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-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.