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.
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,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.
uses crt;
var a:array[1..1000]of integer;
i,n,k,dem: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);
for i:=1 to n do
if a[i]=k then
begin
writeln(i);
break;
end;
dem:=0;
for i:=1 to n do
if a[i]=k then inc(dem);
if dem>0 then writeln('Co ',dem,' phan tu bang ',k)
else writeln('Khong co phan tu nao bang ',k);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
double b[100],x,ln,t;
int i,n,dem;
int main()
{
cin>>n;
ln=-1e10;
for (i=1; i<=n; i++)
{
cin>>b[i];
ln=max(ln,b[i]);
}
for (i=1; i<=n; i++)
cout<<b[i]<<" ";
cout<<endl;
cout<<ln<<endl;
t=0;
dem=0;
for (i=1; i<=n; i++)
if (a[i]>x)
{
t=t+a[i];
dem++;
}
cout<<fixed<<setprecision(2)<<t/(dem*1.0);
return 0;
}
uses crt;
var a:array[1..100]of integer;
i,n,max,min: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];
min:=a[1];
for i:=1 to n do
begin
if max<a[i] then max:=a[i];
if min>a[i] then min:=a[i];
end;
writeln('Gia tri lon nhat la: ',max);
writeln('Gia tri nho nhat la: ',min);
readln;
end.
uses crt;
const fi='ketqua.out';
var f1:text;
a:array[1..100]of integer;
i,n,min:integer;
begin
clrscr;
assign(f1,fi); rewrite(f1);
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
min:=a[1];
for i:=1 to n do
if min>a[i] then min:=a[i];
writeln(f1,min);
close(f1);
readln;
end.
Var a:array[1..100] of integer;
i,d1,d2:integer;
Begin
For i:=1 to 100 do
Begin
Write('Nhap phan tu thu ',i);readln(a[i]);
End;
For i:=1 to 100 do
If a[i] mod 2 = 0 then d1:=d1+1
Else d2:=d2+1;
Writeln('So phan tu chan la ',d1);
Write('So phan tu le la ',d2);
Readln;
End.
uses crt;
var n,i,a[100],dem1,dem2:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
dem1:=0;
dem2:=0;
for i:=1 to n do
begin
if a[i] mod 2=0 then inc(dem1)
else inc(dem2);
end;
writeln(dem1,' ',dem2);
readln;
end.