Những câu hỏi liên quan
LA VAN CAU
Xem chi tiết
U Lan
Xem chi tiết
U Lan
Xem chi tiết
U Lan
Xem chi tiết
U Lan
Xem chi tiết
Lê Tuấn Anh
Xem chi tiết
Minh Lệ
23 tháng 4 2020 lúc 11:18

Câu 1:

Program hotrotinhoc_hoc24;

const fi='mang.txt';

fo='tong.txt';

var f: text;

a,b,c,d: integer;

procedure ip;

begin

assign(f,fi);

reset(f);

read(f,a,b,c,d);

close(f);

end;

procedure out;

begin

assign(f,fo);

rewrite(f);

write(f,a+b+c+d);

close(f);

end;

begin

ip;

out;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
23 tháng 4 2020 lúc 11:29

Câu 1:

const fi='mang.txt';
fo='tong.txt';
var f1,f2:text;
dem,i,t:integer;
a:array[1..4]of integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
dem:=0;
while not eoln(f1) do
begin
inc(dem);
read(f1,a[dem]);
end;
t:=0;
for i:=1 to dem do
t:=t+a[i];
writeln(f2,t);
close(f1);
close(f2);
end.

Câu 2:

const fi='ptb2.txt';
fo='ketqua.txt';
var f1,f2:text;
a,b,c,delta,x1,x2:real;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,a,b,c);
delta:=sqr(b)-4*a*c;
if delta>0 then
begin
x1:=(-b-sqrt(delta))/2*a;
writeln(f2,'x1=',x1:4:2);
x2:=(-b+sqrt(delta))/2*a;
writeln(f2,'x2=',x2:4:2);
end
else if delta=0 then writeln(f2,'x1=x2=',-b/(2*a):4:2)
else writeln(f2,'phuong trinh vo nghiem');
close(f1);
close(f2);
end.

Câu 5:

const fi='dulieu.dat';
fo='tb.dat';
var f1,f2:text;
a:array[1..4]of integer;
dem,i:integer;
tb:real;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
dem:=0;
while not eof(f1) do
begin
inc(dem);
read(f1,a[dem]);
end;
tb:=0;
for i:=1 to dem do
tb:=tb+a[i];
writeln(f2,tb/dem:4:2);
close(f1);
close(f2);
end.

 

Bình luận (0)
Minh Lệ
23 tháng 4 2020 lúc 11:30

Câu 2:

Program hotrotinhoc_hoc24;

const fi='ptb2.txt';

fo='ketqua.txt';

var f: text ;

a,b,c,denta: real;

procedure ip;

begin

assign(f,fi);

reset(f);

read(f,a,b,c);

close(f);

end;

procedure out;

begin

assign(f,fo);

rewrite(f);

denta:=sqr(b)-4*(a)*(c);

if denta<0 then write(f,'Phuong trinh vo nghiem');

if denta=0 then write(f,'Phuong trinh co nghiem kep ,gia tri x=',-(b/2*a));

if denta>0 then write(f,'Phuong trinh co hai nghiem phan biet,gia tri x1=',(-(b)+sqr(denta))/(2*a):1:2,' gia tri x2=',(-(b)-sqr(denta))/(2*a):1:2);

close(f);

end;

begin

ip;

out;

end.

Bình luận (0)
An
Xem chi tiết
Minh Lệ
14 tháng 4 2022 lúc 6:16

Program HOC24;

var f1,f2: text;

a,b: integer;

t: longint;

begin

assign(f1,'input.pas');

reset(f1);

assign(f2,'output.pas');

rewrite(f2);

readln(f1,a,b);

t:=a*b;

write(f2,t);

close(f1);

close(f2);

End.

Bình luận (0)
Lan Ngọc
Xem chi tiết
Nguyễn Lê Phước Thịnh
10 tháng 1 2022 lúc 23:13

#include <bits/stdc++.h>

using namespace std;

long long a,b;

double tb;

int main()

{

freopen("dulieu.inp","r",stdin);

freopen("ketqua.out","w",stdout);

cin>>a>>b;

cout<<a<<" "<<b;

cout<<fixed<<setprecision(2)<<(a*1.0+b*1.0)/(2*1.0);

return 0;

}

Bình luận (0)
Đào Xuân Trọng
Xem chi tiết
Phía sau một cô gái
10 tháng 5 2023 lúc 19:39

with open('XAU.INP', 'r') as input_file, open('XAU.OUT', 'w') as output_file:

        for line in input_file:

                length = len(line.strip())

                output_file.write(f'{length}\n')

Bình luận (0)