Những câu hỏi liên quan
Gin k4 FF
Xem chi tiết
Lê thị anh thư
Xem chi tiết
Hưng Cận
Xem chi tiết
Nguyễn Lê Phước Thịnh
7 tháng 5 2021 lúc 21:31

uses crt;

var x,y:integer;

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

function tong(a,b:integer):integer;

begin

tong:=a+b;

end;

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

funtion hieu(a,b:integer):integer;

begin

hieu:=a-b;

end;

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

function tich(a,b:integer):integer;

begin

tich:=a*b;

end;

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

function thuong(a,b:integer):real;

begin

thuong:=a/b;

end;

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

begin

clrscr;

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

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

writeln('Tong la: ',tong(x,y));

writeln('Hieu la: ',hieu(x,y));

writeln('Tich la: ',tich(x,y));

writeln('Thuong la: ',thuong(x,y):4:2);

readln;

end.

Bình luận (0)
Trần Hiểu Băng
Xem chi tiết
Nguyễn Lê Phước Thịnh
5 tháng 4 2022 lúc 14:06

uses crt;

var x,y:integer;

//chuongtrinhcon

function tong(a,b:integer):integer;

begin

tong:=a+b;

end;

//chuongtrinhchinh

begin

clrscr;

readln(x,y);

writeln(tong(x,y));

readln;

end.

Bình luận (0)
Thúy Hà
Xem chi tiết
Nguyễn Lê Phước Thịnh
13 tháng 4 2021 lúc 12:17

uses crt;

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

i,n,t:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

t:=0;

for i:=1 to n do 

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

writeln(t);

readln;

end.

Bình luận (0)
Duy
Xem chi tiết
32.Thuỳ 7/2
Xem chi tiết
Nguyễn Hoàng Duy
13 tháng 3 2023 lúc 22:56

1.

Var i ,n : integer;

S , T : real;

Begin

Write ('n:') ;

Read (n) ;

S:= 0;

T:= 1;

For i:= 1 to n do

S:= S + i;

T:= T * i;

Writeln (' Tong cua ' ,n,' , S );

Writeln (' Tich của ' ,n,', T );

Readln;

End.

Bình luận (0)
Nguyễn Hoàng Duy
13 tháng 3 2023 lúc 23:02

2.

program SumAndProductOfNumbers;

var
  n, m, i, sum, product: integer;

begin
  writeln('Enter the values of n and m: ');
  readln(n, m);
  
  sum := 0;
  product := 1;
  
  for i := n to m do
  begin
    sum := sum + i;
    product := product * i;
  end;
  
  writeln('The sum of numbers from ', n, ' to ', m, ' is: ', sum);
  writeln('The product of numbers from ', n, ' to ', m, ' is: ', product);
end.

Bình luận (0)
Nguyễn Hoàng Duy
13 tháng 3 2023 lúc 23:03

3.

program SumAndProductOfNumbers;

var
  i, sum, product: integer;

begin
  sum := 0;
  product := 1;
  
  for i := 10 to 25 do
  begin
    sum := sum + i;
    product := product * i;
  end;
  
  writeln('The sum of numbers from 10 to 25 is: ', sum);
  writeln('The product of numbers from 10 to 25 is: ', product);
end.

Bình luận (0)
Trong nhóm zalo
Xem chi tiết
hà nội 123
Xem chi tiết
Nguyễn Lê Phước Thịnh
13 tháng 5 2021 lúc 16:59

1:

function dt(r:real):real;

begin

dt:=sqr(r)*pi;

end;

Bình luận (0)
Nguyễn Lê Phước Thịnh
13 tháng 5 2021 lúc 16:59

2:

function dt(a,b:real):real;

begin

dt:=1/2*a*b;

end;

Bình luận (0)
Nguyễn Lê Phước Thịnh
13 tháng 5 2021 lúc 16:59

3:

function dt(a,b,c:real):real;

var p,s:real;

begin

p:=(a+b+c)/2;

s:=sqrt(p*(p-a)*(p-b)*(p-c));

dt:=s;

end;

Bình luận (0)