Viết chương trình tính diện tích và chu vi tam giác trong pascal
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:real;
begin
clrscr;
readln(a,b,c);
writeln(a+b+c:4:2);
readln;
end.
uses crt;
var a: integer;
begin clrscr;
Writeln('Nhap vao do dai canh cua tam giac deu: '); readln(a);
Writeln('Chu vi cua tam giac deu do la: ',a*3);
readln;
end.
Var r,s,c:real;
Begin
Write('Ban kinh = ');readln(r);
s:=3.14*r*r;
c:=2*3.14*r;
Writeln('Dien tich la ',s:10:2);
Write('Chu vi la ',c:10:2);
Readln
End.
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;
}
uses crt;
var a:integer;
begin
clrscr;
readln(a);
writeln(a*4);
writeln(a*a);
readln;
end.
Program Dien_tich_tam_giac;
Var
a,b,c:Integer;
p,s:Real;
Begin
Writeln('DIEN TICH TAM GIAC');
Writeln('------------------');
Write('-Nhap so thu nhat: ');
Readln(a);
Write('-Nhap so thu hai : ');
Readln(b);
Write('-Nhap so thu ba : ');
Readln(c);
If (a+b>c) And (b+c>a) And (c+a>b) Then
Begin
Writeln('+Dung la Tam giac');
p:=0.5*(a+b+c);
s:=Sqrt(p*(p-a)*(p-b)*(p-c));
Writeln('+Dien tich= ',s:10:2);
End
Else
Writeln('+Khong phai la Tam giac');
Writeln;
Writeln(' Bam phim <Enter> de ket thuc');
Readln
End.
#include <bits/stdc++.h>
using namespace std;
double p,a,b,c,cv,s;
int main()
{
cin>>a>>b>>c;
cv=a+b+c;
p=cv/2;
s=sqrt(p*(p-a)*(p-b)*(p-c));
cout<<fixed<<setprecision(2)<<cv<<endl;
cout<<fixed<<setprecision(2)<<s;
return 0;
}
Program Hinh_Tamgiac_Program;
Uses crt;
Var a,b,c,s,p : real;
Begin
Clrscr;
Writeln(‘HINH TAM GIAC:’);
Write(‘nhap a =’);readln(a);
Write (‘nhap b =’);readln(b); Write(‘nhap c =’);readln(c);
If ((a+b)>c)and((b+c)>a)and((a+c)>b) then
Begin
p:=(a+b+c)/2;
s:=sqrt(p*(p-a)*(p-b)*(p-c)); Writeln(‘Chu vi tam giac:’,2*p:4:2) ; Writeln(‘Dien tich tam giac:’,s:4:2);
End
Else
Writeln(a,’, ‘, b,’, ‘, c, ‘ khong phai la ba canh cua tam giac’) ;
Readln;
End.