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.
var a,b,s:integer;
c:word;
begin
write('nhap avà b ');
read(a,b);
s:=a*b*1/2;
c:=(a+b)*2;
writeln('dien tich la '; s );
write('chu vi la 'c);
readln
end
program CVDT;
uses crt;
var a,b,c,P,S;
begin
Writeln('Nhap a va b');
Readln(a,b);
c:= a*a +b*b; S:= (a*b)/2;
Writeln('Dien tich tam giac vuong la ',S);
writeln('Chu vi tam giac vuong la ', SQRT(c);
Readln;
end.
#include <bits/stdc++.h>
using namespace std;
double a,b,c,p,s;
bool kt;
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))
{
kt=false;
if (a*a==b*b+c*c) kt=true;
if (b*b==a*a+c*c) kt=true;
if (c*c==a*a+b*b) kt=true;
if (kt==false) cout<<"Day khong la ba canh trong mot tam giac vuong";
else {
p=(a+b+c)/2;
s=sqrt(p*(p-a)*(p-b)*(p-c));
cout<<fixed<<setprecision(2)<<s;
}
}
else cout<<"Day khong la ba canh trong mot tam giac vuong";
}
#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;
}
#include <bits/stdc++.h>
using namespace std;
double a,s;
int main()
{
cin>>a;
s=1/2*a*a;
cout<<fixed<<setprecision(2)<<s;
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.
#include <bits/stdc++.h>
using namespace std;
double a,s;
int main()
{
cin>>a;
s=1/2*a*a;
cout<<fixed<<setprecision(2)<<s;
return 0;
}
Cho dễ nhìn hơn:
#include <bits/stdc++.h> using namespace std; int a,b,c; int main() { cin>>a>>b>>c; if ((a+b>c) and (a+c>b) and (b+c>a)) { double p=(a+b+c)/2; cout<<"S="<<sqrt(p*(p-a)*(p-b)*(p-c)); } else cout<<"Khong la ba canh tam giac"; return 0; }