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='dulieu.txt';

fo='tong.doc';

var f1,f2:text;

n,i,s:integer;

begin

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

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

readln(f1,n);

s:=0;

for i:=1 to n do

s:=s+i;

writeln(f2,s);

close(f1);

close(f2);

end.

Bài 1:

const fi='input.txt';

fo='output.txt';

var f1,f2:text;

a,b,s:integer;

begin

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

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

readln(f1,a,b);

s:=a*b;

writeln(f2,s);

close(f1);

close(f2);

end.

Bài 2:

const fi='dulieu.txt';

fo='ketqua.txt';

var f1,f2:text;

a,b:integer;

begin

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

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

readln(f1,a,b);

if a>b then writeln(f2,a)

else if b>a then writeln(f2,b)

else writeln(f2,' khong co so lon nhat trong hai so');

close(f1);

close(f2);

end.

7 tháng 5 2020

Program hotrotinhoc_hoc24;

const fi='dulieu.txt';

fo='ketqua.txt';

var f: text;

a,b,c : integer;

procedure ip;

begin

assign(f,fi);

reset(f);

read(f,a,b,c);

close(f);

end;

procedure out;

begin

assign(f,fo);

rewrite(f);

if (a+b>c) and (a+c>b) and (b+c>a) then write(f,a+b+c);

close(f);

end;

begin

ip;

out;

end.

7 tháng 5 2020

Bài 1:

Program hotrotinhoc_hoc24;

const fi='dulieu.txt';

var a,b: integer;

f: text;

procedure ip;

begin

assign(f,fi);

reset(f);

read(f,a,b);

close(f);

end;

begin

ip;

writeln('Tong la : ',a+b);

write('Hieu la : ',a-b);

readln

end.

#include <bits/stdc++.h>

using namespace std;

long long n,i,t;

int main()

{

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

freopen("uot.txt","w",stdout);

cin>>n;

t=0;

for (i=1; i<=n; i++)

if (i%2==0) t+=i;

cout<<t;

return 0;

}

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

}

uses crt;

const fi='dulieu.txt';

var f1:text;

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

t:real;

i,n:integer;

begin

clrscr;

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

readln(f1,n);

for i:=1 to n do readln(f1,a[i]);

t:=0;

for i:=1 to n do t:=t+a[i];

writeln(t);

close(f1);

readln;

end.

const fi='tong.inp';

fo='tong.out';

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

readln(f1,n);

for i:=1 to n do 

  read(f1,a[i]);

t:=0;

for i:=1 to n do 

  t:=t+a[i];

writeln(f2,t);

close(f1);

close(f2);

end.

const fi='songuyen.txt';
fo='sole.txt';
var f1,f2:text;
n,i,t:integer;
a:array[1..100]of integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
n:=0;
while not eoln(f1) do
begin
inc(n);
read(f1,a[n]);
end;
t:=0;
for i:=1 to n do
if a[i] mod 2=1 then t:=t+a[i];
writeln(f2,t);
close(f1);
close(f2);
end.

uses crt;

const fi='dulieu.txt';

var f1:text;

a,b,c:integer;

begin

clrscr;

assign(f1,fi); rewrite(f1);

write('Nhap a='); readln(a);

write('Nhap b='); readln(b);

write('Nhap c='); readln(c);

writeln(f1,a);

writeln(f1,b);

writeln(f1,c);

close(f1);

end.