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.

Câu 1:

uses crt;
var a,b,c,d,t:integer;
{------------------------chuong-trinh-con-tinh-tong-cua-hai-so-----------------}
function tong(var x,y:integer):integer;
begin
tong:=x+y;
end;
{------------------------chuong-trinh-chinh----------------------}
begin
clrscr;
write('Nhap so thu nhat: '); readln(a);
write('Nhap so thu hai: '); readln(b);
write('Nhap so thu ba: '); readln(c);
write('Nhap so thu tu: '); readln(d);
t:=tong(a,b)+tong(c,d);
writeln('Tong cua bon so la: ',t);
readln;
end.

Câu 2:

const fi='dulieu.dat';

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

uses crt;

const fi='dulieu.dat';

var f1:text;

a,b,p,s:array[1..100]of real;

i,n:integer;

begin

clrscr;

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

n:=0;

while not eof(f1) do 

begin

n:=n+1;

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

end;

for i:=1 to n do 

  begin

p[i]:=(a[i]+b[i])/2;

s[i]:=a[i]*b[i];

end;

for i:=1 to n do 

  writeln(p[i]:4:2,' ',s[i]:4:2);

close(f1);

readln;

end.

uses crt;

const fi='so.inp';

var f1:text;

a,b:integer;

begin

clrscr;

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

while not eof(f1) do 

 begin

readln(f1,a,b);

writeln((a+b)/2:4:2);

end;

close(f1);

readln;

end.

var s:string;

f1:text;

a:byte;

begin

assign(f1,'c:\ghixau1.txt'); rewrite(f1);

readln(s);

writeln(f1,s);

close(f1);

End.

17 tháng 12 2021

#include <bits/stdc++.h>

using namespace std;

long long n,x;

int main()

{

cin>>n>>x;

cout<<pow(n,x);

return 0;

}

const fi='input.txt';

fo='output.txt';

var f1,f2:text;

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

i,n,t:integer;

begin

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

assign(f2,fo); rewrite(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];

write(f2,t);

close(f1);

close(f2);

end.

10 tháng 5 2020

Program hotrotinhoc_hoc24;

const fi='dlv.inp';

fo='dlr.out';

var i,n,t: integer;

f: text;

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

procedure ip;

begin

assign(f,fi);

reset(f);

readln(f,n);

for i:=1 to n do read(f,a[i]);

close(f);

end;

procedure out;

begin

assign(f,fo);

rewrite(f);

t:=0;

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

write(f,t);

close(f);

end;

begin

ip;

out;

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

var f1:text;

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

min,n,i:integer;

{----------------chuong-trinh-con-------------------}

function nn(x,y:integer):integer;

begin

if x<y then nn:=x

else nn:=y;

end;

{-----------------chuong-trinh-chinh-----------------}

begin

clrscr;

write('nhap n='); readln(n);

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

min:=nn(a[1],a[2]);

for i:=3 to n do 

  if min>a[i] then min:=a[i];

writeln(min);

readln;

end.

Mình xin sửa lại một chút:

uses crt;

const fi='kiemtra.txt';

var f1:text;

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

min,n,i:integer;

{----------------chuong-trinh-con-------------------}

function nn(x,y:integer):integer;

begin

if x<y then nn:=x

else nn:=y;

end;

{-----------------chuong-trinh-chinh-----------------}

begin

clrscr;

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

readln(f1,n);

for i:=1 to n do 

  read(f1,a[i]);

min:=nn(a[1],a[2]);

for i:=3 to n do 

  if min>a[i] then min:=a[i];

writeln(min);

readln;

end.