hehe

mail@pastecode.io avatar
unknown
c_cpp
2 years ago
1.2 kB
3
Indexable
Never
#include<bits/stdc++.h>
using namespace std;

void kiemTraTamGiac(float a, float b, float c) {
	if ((a + b > c) || (a + c > b) || (b + c > a)) {
		cout << "a b c tao nen tam giac" << endl;
	}
	else{
		cout << "a b c khong tao nen tam giac" << endl;
	}
}

void kiemTraTamGiacGi(float a, float b, float c) {

	if ((a == b) && (a == c) && (b == c)) {
		cout << "a b c tao nen tam giac deu";
	}

	else if ((a == b) || (a == c) || (b == c)) {
		
		if ((abs((b * b + c * c) - a * a) < 0.1) || (abs((a * a + c * c) - b * b) < 0.1) || (abs((b * b + a * a) - c * c) < 0.1)) {
				cout << "a b c tao nen tam giac vuong can";
		}
		
		else {
			cout << "a b c tao nen tam giac can";
		}
	}
	 
	else if ((abs((b * b + c * c) - (a * a)) < 0.02) || (abs((a * a + c * c) - (b * b)) < 0.02) || (abs((b * b + a * a) - (c * c)) < 0.02)) {
			cout << "a b c tao nen tam giac vuong";
	}

	else {
		cout << "a b c tao nen tam giac thuong";
	}
} 




int main() {
	float a, b, c;
	cout << "a = ";
	cin >> a;

	cout << "b = ";
	cin >> b;

	cout << "c = ";
	cin >> c;

	kiemTraTamGiac(a, b, c);
	kiemTraTamGiacGi(a, b, c);
	
}