Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- bool checkValidity(int a, int b, int c)
- {
- if (a + b <= c || a + c <= b || b + c <= a)
- return false;
- else
- return true;
- }
- using namespace std;
- int main () {
- int i,N;
- double area,s;
- double a,b,c;
- cin>>N;
- for(int i=1;i<=N;i++){
- cin>>a>>b>>c;
- if (checkValidity(a, b, c)){
- s=(a+b+c)/2;
- area=sqrt(s *(s-a)*(s-b)*(s-c));
- printf("%.2lf\n",area);
- }
- else
- printf("Oh, No!\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement