Viết chương trình nhập vào 3 số a,b,c. Kiểm tra xem a,b, c có phải là tam giác cân hay 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.
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.
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;
}
program tamgiac;
uses crt;
var a,b,c:integer;
begin
clrscr;
writeln('nhap ba canh cua tam giac'); readln(a,b,c);
if a+b>c and a+c>b and b+c>a then write(a,' ',b,' ',c 'la ba canh cua tam giac') else write(a,' ',b,' ',c 'khong la ba canh cua tam giac');
readln
end.
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.
uses crt;
var a,b,c,p,s: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
p:=(a+b+c)/2;
s:=sqrt(p*(p-a)*(p-b)*(p-c));
writeln('Chu vi la: ',2*p:4:2);
writeln('Dien tich la: ',s:4:2);
end
else writeln('A B C khong phai la chieu dai ba canh cua mot tam giac');
readln;
end.
#include<iostream>
using namespace std;
int main() {
double a, b, c;
cout << "Canh 1: "; cin >> a;
cout << "Canh 2: "; cin >> b;
cout << "Canh 3: "; cin >> c;
if (a > 0 && b > 0 && c > 0) {
if (a < b + c || b < a + c || c < a + b) {
cout << "Day la do dai ba canh cua mot tam giac";
} else {
cout << "Day khong phai do dai ba canh cua mot tam giac";
}
}else {
cout << "Do dai cac canh cua mot tam giac phai lon hon 0";
}
return 0;
}
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.