Câu 1:
uses crt;
var i,j:longint;
begin
clrscr;
for i:=0 to 9 do
begin
for j:=0 to 9 do
write(10*i+j:4);
writeln;
end;
readln
end.
var i,n:integer;
dtbtoan,dtbvan:real;
diemtoan,diemvan: array[1..100] of real;
begin
write('nhap n='); readln(n);
for i:=1 to n do
begin
write('diem toan ban thu ',i,' la:'); readln(diemtoan[i]);
write('diem van ban thu ',i,' la:'); readln(diemvan[i]);
end;
write('diem trung binh:');
for i:=1 to n do
writeln('ban thu ',i,' la: ',(diemtoan[i]+diemvan[i])/2:3:1);
dtbtoan:=0; dtbvan:=0;
for i:=1 to n do
begin
dtbtoan:=dtbtoan+diemtoan[i];
dtbvan:=dtbvan+diemvan[i];
end;
dtbtoan:=dtbtoan/n; dtbvan:=dtbvan/n;
writeln('diem trung binh mon toan la:',dtbtoan:3:1);
writeln('diem trung binh mon van la:',dtbvan:3:1);
end.
Câu 2:
uses crt;
var n:longint;
function kt(k:longint):longint;
var i:longint;
begin
kt:=1;
if k<=1 then kt:=0;
for i:=2 to trunc(sqrt(k)) do
if k mod i=0 then kt:=0;
end;
begin
clrscr;
write('Nhap n: ');readln(n);
if kt(n)=1 then writeln('La so nguyen to') else writeln('Ko la so nguyen to');
readln
end.
Câu 3: Do mình chưa hiểu rõ đề bài nên mình ko làm nha bạn!!! ^_^