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.
uses crt;
var a,b,c,p,s,am,bn,cp:real;
begin
clrscr;
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
writeln('Day la ba canh trong mot tam giac vuong');
p:=(a+b+c)/2;
s:=sqrt(p*(p-a)*(p-b)*(p-c));
writeln('Dien tich tam giac la: ',s:4:2);
am:=sqrt(2*(sqr(b)+sqr(c))-sqr(a))/4;
bn:=sqrt(2*(sqr(a)+sqr(c))-sqr(b))/4;
cp:=sqrt(2*(sqr(a)+sqr(b))-sqr(c))/4;
writeln('Do dai duong trung tuyen ung voi canh a la: ',am:4:2);
writeln('Do dai duong trung tuyen ung voi canh b la: ',bn:4:2);
writeln('Do dai duong trung tuyen ung voi canh c la: ',cp:4:2);
end
else writeln('Day khong la ba canh trong mot tam giac');
readln;
end.
uses crt;
var a,b,c,p,s:real;
begin
clrscr;
readln(a,b,c);
if (a>0) and (b>0) and (c>0) and (a+b>c) and (a+c>b) and (b+c>a) then
begin
p:=(a+b+c)/2;
s:=sqrt(p*(p-a)*(p-b)*(p-c));
writeln('Chu vi la: ',2*p:4:2);
writeln('Dien tich la: ',s:4:2);
end
else writeln('A B C khong phai la chieu dai ba canh cua mot tam giac');
readln;
end.
#include <bits/stdc++.h>
using namespace std;
double a,b,c;
int main()
{
cin>>a>>b>>c;
if ((a>0) and (b>0) and (c>0) and (a+b>c) and (a+c>b) and (b+c>a)) cout<<"Day la ba canh trong mot tam giac";
else cout<<"Day khong la ba canh trong mot tam giac";
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 ạ
#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;
}