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.
#include <bits/stdc++.h>
using namespace std;
double a,b,c,p,s;
int main()
{
cin>>a>>b>>c;
p=(a+b+c)/2;
s=sqrt(p*(p-a)*(p-b)*(p-c));
cout<<"Chu vi la:"<<fixed<<setprecision(2)<<p*2<<endl;
cout<<"Dien tich la:"<<fixed<<setprecision(2)<<s;
return 0;
}
uses crt;
const fi='bai1.inp';
var f1:text;
a,b,c,cv,dt,p:real;
begin
clrscr;
assign(f1,fi); rewrite(f1);
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
write('Nhap c='); readln(c);
if (a>0) and (b>0) and (c>0) and (a+b>c) and (a+c>b) and (b+c>a) then
begin
cv:=a+b+c;
p:=cv/2;
dt:=sqrt(p*(p-a)*(p-b)*(p-c));
writeln(f1,'Chu vi la: ',cv:4:2);
writeln(f1,'Dien tich la: ',dt:4:2);
end
else writeln(f1,'Day khong la ba canh trong mot tam giac');
close(f1);
readln;
end.
cho em hỏi cái này viết ra thuật toán thì viết kiểu sao ạ
2:
#include <bits/stdc++.h>
using namespace std;
double a,b,c,p,s;
int main()
{
cin>>a>>b>>c;
p=(a+b+c)/2;
s=sqrt(p*(p-a)*(p-b)*(p-c));
cout<<fixed<<setprecision(2)<<s;
return 0;
}
Tham khảo
program hcn;
uses crt;
var d,r,dt:longint;
cv:real;
begin
write('nhap chieu dai va chieu rong cua hcn:');
readln(d,r);
cv:=(d+r)*2;
dt:=d*r;
writeln(' chu vi hcn do la:',cv);
writeln(' dien tich hcn do la:',dt);
readln
end.
#include <bits/stdc++.h>
using namespace std;
double xa,ya,xb,yb,xc,yc,ab,ac,bc;
int main()
{
cin>>xa>>ya>>xb>>yb>>xc>>yc;
ab=(sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb)));
ac=(sqrt((xa-xc)*(xa-xc)+(ya-yc)*(ya-yc)));
bc=(sqrt((xb-xc)*(xb-xc)+(yb-yc)*(yb-yc)));
p=(ab+bc+ac)/2;
s=sqrt(p*(p-ab)*(p-ac)*(p-bc));
cout<<"Dien tich la:"<<fixed<<setprecision(2)<<s<<endl;
cout<<"Duong cao ung voi dinh A la:"<<fixed<<setprecision(2)<<2*s/bc<<endl;
cout<<"Duong cao ung voi dinh B la:"<<fixed<<setprecision(2)<<2*s/ac<<endl;
cout<<"Duong cao ung voi dinh C la:"<<fixed<<setprecision(2)<<2*s/ab<<endl;
return 0;
}
uses crt;
var a,b,c,p,s:real;
begin
clrscr;
repeat
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
write('Nhap c='); readln(c);
until (a>0) and (b>0) and (c>0) and (a+b>c) and (a+c>b) and (b+c>a);
p:=(a+b+c)/2;
s:=sqrt(p*(p-a)*(p-b)*(p-c));
writeln(s:4:2);
readln;
end.
uses crt;
var a,b,c,p:real;
{---------------chuong-trinh-con-tinh-chu-vi-------------------------}
fucntion cv(x,y,z:real):real;
begin
cv:=x+y+z;
end;
{---------------------chuong-trinh-chinh-----------------------}
begin
clrscr;
repeat
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
write('Nhap c='); readln(c);
until (a>0) and (b>0) and (c>0) and (a+b>c) and (a+c>b) and (b+c>a);
writeln('Chu vi la: ',cv:4:2);
p:=cv/2;
writeln('Dien tich la: ',sqrt(p*(p-a)*(p-b)*(p-c)):4:2);
readln;
end.
uses crt;
var a,b,c:integer;
p:real;
begin
clrscr;
write('nhap a:');readln(a);
write('nhap b:');readln(b);
write('nhap c:');readln(c);
clrscr;
p:=(a+b+c)/2;
writeln('Chu vi hinh tam giac la: ',a+b+c);
write('Dien tich hinh tam giac la: ,sqrt(p*(p-a)*(p-b)*(p-c)):0:2);
readln;
end.