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.

const fi='dl.txt';
var i:integer;
f:text;
begin
assign(f,fi); rewrite(f);
for i:=1 to 50 do
write(f,i,' ');
close(f);
end.

uses crt;

const fi='dl.txt';

fo='soam.txt';

var f1,f2:text;

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

i,n:integer;

begin

clrscr;

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

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

n:=0;

while not eoln(f1) do 

  begin

n:=n+1;

read(f1,a[n]);

end;

for i:=1 to n do 

begin

  if a[i]>0 then writeln('Can bac hai cua ',a[i],' la: ',sqrt(a[i]):4:2)

else if a[i]<0 then write(f2,a[i]:4);

end;

close(f1);

close(f2);

readln;

end.

uses crt;

const fi='dl.txt';

fo='soam.txt';

var f1,f2:text;

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

i,n:integer;

begin

clrscr;

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

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

n:=0;

while not eoln(f1) do 

  begin

n:=n+1;

read(f1,a[n]);

end;

for i:=1 to n do 

begin

  if a[i]>0 then writeln('Can bac hai cua ',a[i],' la: ',sqrt(a[i]):4:2)

else if a[i]<0 then write(f2,a[i]:4);

end;

close(f1);

close(f2);

readln;

end.

#include <bits/stdc++.h>

using namespace std;

long long i,a[100],n;

int main()

{

freopen("songuyen.txt","r",stdin);

n=20;

for (i=1; i<=n; i++) cin>>a[i];

for (i=1; i<=n; i++) cout<<a[i]<<" ";

return 0;

}

15 tháng 5 2023

Program HOC24;

var i,n: integer;

t: longint;

f1,f2: text;

begin

assign(f1,'BAI1.INP');

reset(f1);

read(f1,n);

t:=0;

for i:=1 to n do if i mod 2=0 then t:=t+i;

close(f1);

assign(f2,'BAI1.OUT');

rewrite(f2);

write(f2,t);

close(f2);

end.

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.

const fi='dulieu.txt';

fo='ketqua.txt';

var f1,f2:text;

m,n,i,t:integer;

begin

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

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

readln(f1,m,n);

t:=0;

for i:=m to n do 

 if i mod 2=0 then t:=t+i;

writeln(f2,t);

close(f1);

close(f2);

end.