Viết chương trình kiểm tra xem tam giác đó có phải là tam giác vuông cân không?
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 <iostream>
using namespace std;
int main()
{
int a,b,c,kt;
cout<<"Nhap a=";
cin>>a;
cout<<"Nhap b=";
cin>>b;
cout<<"Nhap c=";
cin>>c;
if ((a>0) and (b>0) and (c>0) and (a+b>c) and (a+c>b) and (b+c>a))
{
kt=0;
if (a*a==b*b+c*c) kt=1;
if (b*b==a*a+c*c) kt=1;
if (c*c==a*a+b*b) kt=1;
if ((a==b) and ((a<c) or (a>c)) and ((b<c) or (b>c))) kt=2;
if ((b==c) and ((b<a) or (b>a)) and ((c<a) or (c>a))) kt=2;
if ((c==a) and ((c<b) or (c>b)) and ((a<b) or (a>b))) kt=2;
if ((a==c) and (b==c)) kt=3;
if (kt==2) cout<<"Day la tam giac can";
else cout<<"Day khong la tam giac can";
}
else cout<<"Day khong la ba canh trong mot tam giac";
return 0;
}
a = float(input("Nhap a : "))
b = float(input("Nhap b : "))
c = float(input("Nhap c : "))
if a+b>c and a+c>b and b+c>a:
if a==b or a==c or b==c:
if a==c==b:
print("Day la ba canh cua tam giac deu")
else:
print("Day la ba canh cua tam giac can")
elif (a**2)+(b**2)==c**2 or (a**2)+(c**2)==b**2 or (c**2)+(b**2)==a**2:
print("Day la ba canh cua tam giac vuong")
else:
pass
else:
print("Day khong phai ba canh cua tam giac")
var a,b,c,s,p: real;
begin
write('Nhap canh thu nhat: '); readln(a);
write('Nhap canh thu hai: '); readln(b);
write('Nhap canh thu ba: '); readln(c);
if (a+b>c) and (b+c>a) and (c+a>b) then
begin
p:=(a+b+c)/2;
s:=sqrt(p*(p-a)*(p-b)*(p-c));
writeln('Chu vi tam giac la ',2*p:5:2, '(dvdd)');
writeln('Dien tich tam giac la: ',s:5:2, '(dvdt)');
if (a=b) and (b=c) then writeln('Day con la tam giac deu') else
if (a=b) or (b=c) or (c=a) then writeln('Day la tam giac can') else
if (a*a+b*b=c*c) or (b*b+c*c=a*a) or (c*c+a*a=b*b) then writeln('Day la tam giac vuong') else
writeln('Day la tam giac thuong');
if ((a=b) or (b=c) or (c=a)) and ((a*a+b*b=c*c) or (b*b+c*c=a*a) or (c*c+a*a=b*b)) then writeln('Day la tam giac vuong can')
end
else writeln(a:5:2,',',b:5:2,',',c:5:2,' khong la do dai mot tam giac');
end.
uses crt;
var a,b,c:real;
kt:integer;
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);
if (a+b>c) and (a+c>b) and (b+c>a) then
begin
kt:=0;
if (a=b) and (a<>c) and (b<>c) then kt:=1;
if (b=c) and (b<>a) and (c<>a) then kt:=1;
if (c=a) and (c<>b) and (a<>b) then kt:=1;
if kt=0 then writeln('Day khong la tam giac can')
else writeln('Day la tam giac can');
end
else writeln('Day khong la ba canh trong mot tam giac');
readln;
end.
uses crt;
var a,b,c:integer;
begin
clrscr;
readln(a,b,c);
if (a=b) and (b=c) then write('YES')
else write('NO');
readln;
end.
uses crt;
var a,b,c: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
if (a=b) and (b=c) then write('Day la tam giac deu')
else writeln('Day khong la tam giac deu');
end
else writeln('Day khong la ba canh trong mot tam giac');
readln;
end.