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.
program mang;
uses crt;
var n,i,chan, le,max,min: Integer;
a:array[1..100] of integer;
begin
write('nhap so phan tu ');read(n);
for i:=1 to n do
begin
write('nhap so thu ',i); readln(a[i]);
end;
max:=a[1]; min:=a[1]; chan:=0;le:=0;
for i:=1to n do
begin
if a[i] > max then max:=a[i];
if a[i] < min then min:=a[i];
if a[i] mod 2 = 0 then chan:=chan+1
else le:=le+1;
end;
writeln('max la: ',max);
writeln('min la: ',min);
writeln('so phan tu chan: ',chan);
writeln('so phan tu le: ',le);
readln
end.
var lan,ha,mai:integer;
begin
write('Tuoi Lan la ');readln(lan);
write('Tuoi Ha la ');readln(ha);
write('Tuoi Mai la ');readln(mai);
write('Tong so tuoi cua ba ban la ',lan+ha+mai);
readln;
end.
a)
var a:array[1..100] of longint;
n,i,max,d:longint;
begin
read(n);
for i:=1 to n do
write('nhap chieu cao, don vi cm');read(a[i]);
b) max:=a[1];
for i:=2 to n do
if a[i]>max then max:=a[i];
writeln('ban cao nhat cao',max);
c) for i:=1 to n do
if a[i]>160 then d:=d+1;
write('so ban cao hon 160 cm la: ',d);
end.
program XuatSoChan;
uses crt;
const
Max_N = 20;
type
MangSoNguyen = array [1..Max_N] of integer;
var
A: MangSoNguyen;
i, n: integer;
begin
clrscr;
write('Nhap so luong phan tu cua mang: ');
readln(n);
writeln('Nhap cac phan tu vao mang:');
for i := 1 to n do
begin
write('A[', i, ']: ');
readln(A[i]);
end;
writeln('Cac so chan trong mang la:');
for i := 1 to n do
begin
if A[i] mod 2 = 0 then
writeln(A[i]);
end;
readln;
end.
Program HOC24;
var min,max,n,i: integer;
t: longint;
a: array[1..1000] of integer;
begin
write('Nhap N: '); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Cac so chan trong mang la: ');
for i:=1 to n do if a[i] mod 2=0 then write(a[i],' ');
writeln;
t:=0;
for i:=1 to n do if a[i] mod 2=1 then t:=t+a[i];
writeln('Tong cac so le la: ',t);
min:=a[1]; max:=a[1];
for i:=1 to n do
begin
if a[i]>max then max:=a[i];
if a[i] <max then max:=a[i];
end;
writeln('Gia tri lon nhat la: ',max);
write('Gia tri nho nhat la:' ,min);
readln
end.
Var a:array[1..200] of real;
i,n,dem:integer;
s,tbc:real;
Begin
Write('Nhap so luong phan tu n = ');readln(n);
s:=0;
For i:=1 to n do
Begin
Write('Nhap phan tu thu ',i,' = ');readln(a[i]);
s:=s+a[i];
End;
tbc:=s/n;
Write('Trung binh cong la ',tbc:10:2);
Readln;
End.
uses crt;
var NS:array[1..100] of integer; Dtoan,Dvan,Dtb:array[1..100] of real;
hoten:array[1..100] of string; i:byte;
begin
clrscr;
for i:=1 to 45 do
begin
write('Nhap ten cua hoc sinh thu',i,':'); readln(hoten[i]);
write('Nhap ngay sinh:'); readln(NS[i]);
write('Nhap diem toan:'); readln(Dtoan[i]);
write ('Nhap diem van:'); readln(Dvan[i]);
Dtb[i]:=(Dtoan[i]+Dvan[i])/2;
end;
writeln('Diem trung binh cua cac ban trong lop la:');
for i:=1 to 45 do
writeln(hoten[i],':',Dtb[i]:1:2);
readln;
end.
Tham khảo thui!
Var a:array:[1..50] of real;
i,max:integer;
Begin
For i:=1 to 50 do
Begin
Write('Nhap so thu ',i,' = ');readln(a[i]);
End;
Write('Cac diem vua nhap la: ');
For i:=1 to 50 do
Write(a[i]:10:2);
Writeln;
max:=a[1];
For i:=2 to 50 do
if a[i]>max then max:=a[i];
Write('Diem trung binh lon nhat la ',max:10:2);
Readln
End.
Var a:array:[1..50] of real;
i:integer;
max:real;
Begin
For i:=1 to 50 do
Begin
Write('Nhap diem thu ',i,' = ');readln(a[i]);
End;
Write('Cac diem vua nhap la: ');
For i:=1 to 50 do
Write(a[i]:10:2);
writeln;
max:=a[1];
For i:=2 to 50 do
if a[i] > max then max:=a[i];
write('Diem lon nhat la ',max:10:2);
Readln
End.
var sn:integer;
begin
write('nhap nam sinh:');readln(sn);
write(2018-sn,'tuoi');
readln;end.