HOC24
Lớp học
Môn học
Chủ đề / Chương
Bài học
Uses crt;
Var i,tong:integer;
Begin
tong:=0;i:=1;
While i<=1000 then
tong:=tong+i;
i:=i+1;
End;
Writeln('Tong: ',tong);
readln;
End.
Chị bổ sung dùm em thêm câu lệnh đóng file f2 nữa nha
Var i,n,k,tong:integer;
tb:real;
a:array[1..1000] of integer;
f1,f2:text;
clrscr;
Assign(f1,'SONGUYEN.inp');
Assign(f2,'SONGUYEN.out');
Reset(f1);Readln(f1,n);
For i:= 1 to n do read(f1,a[i]);
close(f1);
k:=0;tong:=0;
For i:= 1 to n do If (a[i]<0) and (Abs(a[i]) mod 2 = 1) then
inc(k);
tong:=tong+a[i];
tb:=tong/n;
Rewrite(f2);
writeln(f2,tb:0:2);
Writeln(f2,k);
close(f2);
Program Tin;
Var i,n:integer
Write('Nhap n: ');readln(n);
Writeln('Nhap ',n,' so nguyen:');
For i:= 1 to n do
Write('A[',i,'] = ');
readln(a[i]);
Writeln('Cac so chan co trong day la:');
For i:= 1 to n do If a[i] mod 2 = 1 then write(a[i],' ');
Readln;
Var tong,n:real;
tong:=0;
While tong<=200 do
readln(n);
tong:=tong+n;
Writeln('Tong: ',tong:0:4);
Var i,n,dem:Integer;
a:array[1..10000] of integer;
Write('Nhap do dai cua day: ');readln(n);
dem:=0;
Writeln('Nhap ',n,' phan tu cua day:');
Write('So thu ',i,': ');
If a[i] mod 2 = 1 then dem:=dem+1;
Writeln('Day co ',dem,' so le');
Var i,n,tong:integer;
Assign(f1,'tinhtong.inp');
Assign(f2,'tinhtong.out');
Reset(f1);readln(f1,n);
read(f1,a[i]);
rewrite(f2);
Writeln(f2,tong);
Var i,n:integer;
Write('Nhap so hoc sinh: ');readln(n);
Writeln('Nhap diem hoc ki mon tin cua ',n,' em hoc sinh:');
For i:=1 to n do
Write('Hoc sinh thu ',i,' : ');
Writeln('Diem kiem tra cua ',n,' em hoc sinh vua nhap la:');
For i:= 1 to n do writeln('Hoc sinh thu ',i,' : ',a[i]);
Write a short paragraph about a tour of a place
Var dai,rong:integer;
Procedure Nhap(Var dai:integer;rong:integer);
Write('Chieu dai: ');readln(dai);
Write('Chieu rong: ');readln(rong);
Procedure Ve(var dai:integer;rong:integer);
var i,j:integer;
for i:= 1 to dai do write('*');writeln;
For i:= 1 to rong-2 do
Write('*');
for j:=1 to dai-2 do write(' ');
writeln('*');
end;
for i:= 1 to dai do write('*');
Nhap(dai,rong);
Ve(dai,rong);