Những câu hỏi liên quan
Meo Meo
Xem chi tiết
Giagg
Xem chi tiết
Minh Lệ
13 tháng 3 2021 lúc 14:15

Program HOC24;

const fi='DULIEU.DAT'

fo='KETQUA.DAT'

var a,x,n: integer;

s: longint;

function luythua(a,b: integer): longint;

var j,t: longint;

begin

t:=1;

for j:=1 to b do t:=t*a;

luythua:=t;

end;

procedure ip;

begin

assign(f,fi);

reset(f);

read(f,a,x,n);

close(f);

end;

procedure out;

begin

assign(f,fo);

rewrite(f);

s:=1;

for i:=1 to n do

s:=s+luythua(x,i)*(a+i);

write(f,s);

close(f);

end;

begin

ip;

out;

end.

Bình luận (0)
Nguyễn Hoàng Thiên Lam
Xem chi tiết
Nguyễn Lê Phước Thịnh
28 tháng 1 2022 lúc 22:41

#include <bits/stdc++.h>

using namespace std;

long long a,b;

int main()

{

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

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

cin>>a>>b;

cout<<a+b;

return 0;

}

Bình luận (0)
Exo Aeri
Xem chi tiết
Nguyễn Lê Phước Thịnh
26 tháng 1 2022 lúc 13:12

#include <bits/stdc++.h>

using namespace std;

long long a[10],b[10],i,j;

int main()

{

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

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

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

for (j=1; j<=10; j++) cin>>b[j];

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

cout<<a[i]+b[i]<<" ";

return 0;

}

Bình luận (0)
Ka Ka
Xem chi tiết
Nguyễn Lê Phước Thịnh
17 tháng 3 2021 lúc 21:41

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.

Bình luận (0)
Kiên Ngọc
Xem chi tiết
Nguyễn Lê Phước Thịnh
17 tháng 2 2023 lúc 7:40

const fi='songuyen.dat'

fo='ketqua.dat'

var f1,f2:text;

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

i,n,s,ln: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]);

s:=1;

ln:=a[1];

for i:=1 to n do

begin

s:=s*a[i];

if ln<a[i] then ln:=a[i];

end;

writeln(f2,s);

writeln(f2,ln);

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)
A3-37-Bùi Ngọc Phương Tr...
Xem chi tiết
Hà Anh
Xem chi tiết
Minh Lệ
26 tháng 2 2021 lúc 17:47

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.

Bình luận (0)
Nguyễn Lê Phước Thịnh
26 tháng 2 2021 lúc 21:30

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.

Bình luận (0)