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

QT
Quoc Tran Anh Le
Giáo viên
28 tháng 11 2023

a) Tên các ổ đĩa trên máy tính: ổ (D:), ổ (C:), ổ (E:).

b) Các em tự xem và trả lời.

Gợi ý:

Tên một số thư mục, tệp có trên ổ đĩa (D:):

Thư mục: Sach, giai tri, Program Files.

Tệp: tin 3.docx

c) Các em tham khảo các bước:

Mở thư mục sach trong ổ đĩa (D:) thư mục con là sach giao khoa và sach tham khoa

Tệp: Tin nang cao.docx

29 tháng 3 2022

var i,n,s:integer;

begin

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

i:=1;

while i<=n do

begin

s:=s+i;

i:=i+1;

end;

write('Tong la ',s);

readln;

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.

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

}

Câu 2: 

uses crt;

var a,b:integer;

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

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

var i,uc:integer;

begin

if x<y then 

begin

uc:=1;

for i:=1 to x do 

  if (x mod i=0) and (y mod i=0) then  

begin

if uc<i then uc:=i;

end;

end

else begin

uc:=1;

for i:=1 to y do 

  if (x mod i=0) and (y mod i=0) then  

begin

if uc<i then uc:=i;

end;

end;

ucln:=uc;

end;

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

begin

clrscr;

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

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

writeln(a,'/',b,'=',a div ucln(a,b),'/',b div ucln(a,b));

readln;

end.

Câu 1: 

const fi='songuyen.inp';

fo='tong.out';

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 eoln(f1) do 

  begin

n:=n+1;

read(f1,a[n]);

end;

t:=0;

for i:=1 to n do 

  if a[i] mod 2=0 then t:=t+a[i];

writeln(f2,t);

close(f1);

close(f2);

end.