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.

24 tháng 11 2021
24 tháng 11 2021

Tham khảo!

 Input : chiều dài là a, chiều rộng là b
 a.   Output : tính diện tích hình chữ nhật
b) Thuật toán: 
- B1: Nhập a; b
- B2 : S := 0; 
- B3: Tính diện tích hình chữ nhật : 
     S := a*b; 
- B4: Thông báo và in kết quả.

24 tháng 11 2021

Tham khảo!

Program …..; (tên)
uses crt;
Var a, b, p, s integer;
Begin;
Write (‘Nhap chieu dai CD’); Readln (a);
Write (‘Nhap chieu rong CR’); Readln (b);
p:= (a+b)*2
S:= a*b
Writeln (‘Chu vi hinh chu nhat:’ ,p);
Writeln (‘Dien tich hinh chu nhat:’ ,S);
Readln;
End.

24 tháng 11 2021
6 tháng 10 2021

\(\dfrac{1}{2}S=\dfrac{1}{2}a.b\)

#include <bits/stdc++.h>

using namespace std;

int main()

{

float a,p,s;

cin>>a;

cin>>p;

s=a*p/2;

cout<<fixed<<setprecision(2)<<s;

return 0;

}

31 tháng 12 2021

#include <bits/stdc++.h>

using namespace std;

double a,b,cv,dt;

int main()

{

cin>>a>>b;

cv=(a+b)*2;

dt=a*b;

cout<<fixed<<setprecision(2)<<cv<<endl;

cout<<fixed<<setprecision(2)<<dt;

return 0;

}

var s,dc:longint;

uses crt;

const fi='x.inp';

var f1:text;

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

i,n:integer;

begin

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

n:=0;

while not eof(f1) do 

begin

n:=n+1;

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

end;

for i:=1 to n do 

  begin

writeln('Chu vi dong ',i,' la: ',(a[i]+b[i])*2);

writeln('Dien tich dong ',i,' la: ',a[i]*b[i]);

end;

close(f1);

readln;

end.

14 tháng 3 2021

15 tháng 3 2021

Đưa kết quả ra màn hình mà bạn.

#include <bits/stdc++.h>

using namespace std;

int main()

{

int a,b;

freopen("hcn.inp","r",stdin);

freopen("hcn.out","w",stdout);

cin>>a>>b;

cout<<(a+b)*2<<endl;

cout<<a*b;

return 0;

}

uses crt;

var a,b:integer;

{-----------------chuong-trinh-con-tinh-chu-vi----------------------------------}

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

begin

cv:=x+y;

end;

{-------------------chuong-trinh-con-tinh-dien-tich-----------------------------}

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

begin

dt:=x*y;

end;

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

begin

clrscr;

write('Nhap chieu dai:'); readln(a);

write('Nhap chieu rong:'); readln(b);

writeln('Chu vi la: ',cv(a,b));

writeln('Dien tich la: ',dt(a,b));

readln;

end.

const fi='hcn.inp';     

fo='hcn.out';

var f1,f2:text;   

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

i,j,n:integer;

begin

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

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

n:=0;

while not eof(f1) do 

begin     

inc(n);     

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

end;

for i:=1 to n do 

writeln(f2,2*(a[i]+b[i]),' ',a[i]*b[i]);

close(f1);

close(f2);

end.