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.
1: Xác định bài toán
-Input: Nhập ba cạnh của tam giác
-Output: Xác định dạng của tam giác đó
2: Viết chương trình
uses crt;
var a,b,c,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 (a=c) and (a<>b) and (c<>b) then kt:=1;
if (a=c) and (b=c) then kt:=2;
if sqr(a)=sqr(b)+sqr(c) then kt:=3;
if sqr(b)=sqr(a)+sqr(c) then kt:=3;
if sqr(c)=sqr(a)+sqr(b) 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');
if (kt=1) and (kt=3) then writeln('Day la tam giac vuong can');
end
else writeln('Day khong la ba canh trong mot tam giac'); readln;
end.
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")
#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;
}
uses crt;
var a, b, c: real;
begin
clrscr;
writeln('Kiem Tra Tam Giac');
write('Nhap Ba Canh a, b, c:'); readln(a, b, c);
if (a+b>c) and (a+c>b) and (b+c>a) then
begin
writeln('Do La Ba Canh Tam Giac');
if (a * a + b * b = c * c) or (a * a + c * c = b * b) or (b * b + c * c = a * a) then
writeln('Tam Giac Vuong')
else if (a = b) or (a = c) or (b = c) then
begin
if (a = b) and (b = c) then
writeln('Tam Giac Deu')
else
writeln('Tam Giac Can');
end
else writeln('Tam Giac Thuong');
end
else write('Khong Phai Tam Giac');
readln
end.
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.
#include <bits/stdc++.h>
using namespace std;
double a,b,c;
bool kt;
int main()
{
cin>>a>>b>>c;
if (a>0 && b>0 && c>0)
{
kt=false;
if (a==b && b!=c && a!=c) kt=true;
if (b==c && b!=a && c!=a) kt=true;
if (c==a && c!=b && a!=b) kt=true;
if (kt==false) cout<<"NO";
else cout<<"YES";
}
else cout<<"NO";
return 0;
}
uses crt;
var a,b:real;
begin
clrscr;
write('Nhap do dai canh thu nhat:'); readln(a);
write('Nhap do dai canh thu hai:'); readln(b);
writeln(sqrt(sqr(a)+sqr(b)):4:2);
readln;
end.
program tamgiac;
uses crt;
var a,b,c: longint;
begin write('Nhap canh a= ');readln(a);
write('Nhap canh b= ');readln(b);
write('Nhap canh c= ');readln(c);
if (a>b+c) or (b>a+c) or (c>a+b) then
writeln('Day khong phai la ba canh tam giac')
else if (a=b) or(b=c) or (a=c) then
writeln('Day la tam giac can') else if (a=b) and (b=c) then
writeln('Day la tam giac dau')
else if (sqr(a)=sqr(b)+sqr(c)) or (sqr(b)=sqr(c)+sqr(a)) or (sqr(c)=sqr(a)+sqr(b)) then writeln('Day la tam giac vuong')
else writeln('Day la tam giac thuong');
readln
end.