K
Khách

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.

26 tháng 2 2021

Bài 1:

Program HOC24;

const fi='in.txt';

fo='out.txt';

var f: text;

i,n: integer;

t: longint;

procedure ip;

begin 

assign(f,fi);

reset(f);

read(f,n);

close(f);

end;

procedure out;

begin

assign(f,fo);

rewrite(f);

t:=1;

for i:=1 to n do t:=t*i;

write(f,t);

close(f);

end;

begin

ip;

out;

end.

Bài 2:

 

Program HOC24;

const fi='in.txt';

fo='out.txt';

var f: text;

i: byte;

a: array[1..4] of string;

procedure ip;

begin 

assign(f,fi);

reset(f);

for i:=1 to 4 do readln(f,a[i]);

close(f);

end;

procedure out;

begin

assign(f,fo);

rewrite(f);

for i:=1 to 4 do writeln(f,a[i]);

close(f);

end;

begin

ip;

out;

end.

1: 

const fi='inp.txt';

fo='out.txt';

var n,i:integer;

s:real;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

readln(f1,n);

s:=1;

for i:=1 to n do 

  s:=s*i;

writeln(f2,s:4:2);

close(f1);

close(f2);

end.

10 tháng 5 2023

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')

const fi='mang.txt';

fo='tong.txt';

var f1,f2:text;

a:array[1..100]of integer;

n,i,t:integer;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewriteln(f2);

n:=0;

while not eof(f1) do 

  begin

inc(n);

read(f1,a[n]);

end;

t:=0;

for i:=1 to n do 

  t:=t+a[i];

writeln(f2,t);

close(f1);

close(f2);

end.

#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;

}

const fi='hinhtron.inp';

fo='hinhtron.out';

var f1,f2:text;

a:array[1..100]of real;

i,n:integer;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

n:=0;

while not eof(f1) do 

begin

n:=n+1;

read(f1,a[n]);

end;

for i:=1 to n do 

writeln(f2,'Hinh tron thu ',i,': Chu vi la ',(2*a[n]*pi):4:2,' va Dien tich la: ',a[n]*a[n]*pi:4:2);

close(f1);

close(f2);

end.

const fi='dulieu.txt';

fo='ketqua.txt';

var f1,f2:text;

a,b:array[1..100]of integer;

n,i:integer;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

n:=0;

while not eof(f1) do

begin

n:=n+1;

readln(f1,a[n],b[n]);

end;

for i:=1 to n do 

begin

if (a[i]<b[i]) then writeln(f2,a[i])

else writeln(f2,b[i]);

end;

close(f1);

close(f2);

end.

const fi='data.txt';

fo='tbc.txt';

var f1,f2:text;

a:array[1..100]of integer;

n,i,t:integer;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

n:=0;

while not eof(f1) do 

  begin

n:=n+1;

readln(f1,a[n]);

end;

t:=0;

for i:=1 to n do 

  t:=t+a[i];

writeln(f2,t/n:4:2);

close(f1);

close(f2);

end.

16 tháng 1 2022

cho tệp DataIn.txt chứa liên tiếp các số nguyên dương hoặc âm, các số trên cùng một dòng ngăn cách nhau bởi dấu cách. viết chương trình đọc các số vào chương trình pascal và tính tổng rồi ghi ra DataOut.txt

xin giúp đỡ ạ