[ create a new paste ] login | about

Link: http://codepad.org/GuhcCNpc    [ raw code | output | fork ]

tothanh10061997 - C++, pasted on Mar 17:
#include<iostream>
#include <math.h>
using namespace std;
bool checktamgiac (int a, int b, int c)
{
	if ((a + b > c) && (a + c > b) && (b + c > 1))
		       return true;
		return false;
}
float tinhdientichtg(int a, int b, int c)
{
	float p = (float)(a + b + c) / 2;

	float s = sqrt((p - a) + (p - b) + (p - c));

	   return s;
}
int main()
{
	int a, b, c;
	cout << "nhap a =" <<endl;
	cin >> a;
	cout << "nhap b =" << endl;
	cin >> b;
	cout << "nhap c =" << endl;
	cin >> c;
	if(checktamgiac(a,b,c)== true)
		cout << "la mot tam giac co dien tich la" << tinhdientichtg(a, b, c);
	else
		cout << "khong phai la mot tam giac ";
	return 0;

}


Output:
1
2
3
4
nhap a =
nhap b =
nhap c =
khong phai la mot tam giac 


Create a new paste based on this one


Comments: