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.
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;
}
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c, S;
cin >> a >> b;
S=(1.0/2)*a*b;
c=sqrt(a*a+b*b);
cout << fixed << setprecision(2) << "Dien tich la " << (double)S << "\nCanh huyen la " << (double)c << endl;
return 0;
}
Chúc bn học tốt!
uses crt;
var xa,ya,xb,yb,xc,yc:integer;
ab,ac,bc,cv,p,s:real;
begin
clrscr;
write('Nhap toa do diem A:'); readln(xa,ya);
write('Nhap toa do diem B:'); readln(xb,yb);
write('Nhap toa do diem C:'); readln(xc,yc);
ab:=sqrt(sqr(xa-xb)+sqr(ya-yb));
ac:=sqrt(sqr(xa-xc)+sqr(ya-yc));
bc:=sqrt(sqr(xb-xc)+sqr(yb-yc));
if (ab+bc>ac) and (ab+ac>bc) and (ac+bc>ab) then
begin
cv:=ab+bc+ac;
p:=cv/2;
s:=sqrt(p*(p-ab)*(p-ac)*(p-bc));
writeln('Chu vi la: ',cv:4:2);
writeln('Dien tich la: ',dt:4:2);
kt:=0;
if (ab=ac) and (ab<>bc) and (ac<>bc) then kt:=1;
if (ac=bc) and (ac<>ab) and (bc<>ab) then kt:=1;
if (ab=bc) and (ab<>ac) and (bc<>ac) then kt:=1;
if (ab=ac) and (ac=bc) then kt:=2;
if sqr(ab)=sqr(ac)+sqr(bc) then kt:=3;
if sqr(ac)=sqr(ab)+sqr(bc) then kt:=3;
if sqr(bc)=sqr(ab)+sqr(ac) then kt:=3;
if kt=0 then writeln('Day la tam giac thuong');
if kt=1 then writeln('Day la tam giac can');
if kt=2 then writeln('Day la tam giac deu');
if kt=3 then writeln('Day la tam giac vuong');
end
else writeln('Day khong phai la toa do 3 dinh cua mot tam giac');
readln;
end.
#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 ạ
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.