Given three sides of a triangle A, B and C in the form of integers. Find the area of the triangle.
Note: The triangle may not exist. In such cases, the area is 0.
Example 1:
Input: A = 2, B = 2, C = 3
Output: 1.984313
Explanation:
The area formed by the triangle whose
sides are 2,2 and 3 units respectively is 
1.984313 units^{2}.
Example 2:
Input: A = 1, B = 3, C = 1
Output: 0.000
Explanation:
Such a triangle does not exist whose 
sides are 1,3 and 1 respectively.Thus,Area is
0.
Your Task:
You don't need to read input or print anything.Your Task is to complete the function findArea() which takes three integers A,B and C as input parameters and returns the area of the triangle formed by the three integers as sides.
Note: Output the answer upto 3 decimal points
Expected Time Complexity:O(1)
Expected Auxillary Space:O(1)
Constraints:
1<=A,B,C,<=10^{4}

Source: geeksforgeeks | Difficulty: EASY
Tags: Mathematics

Starter code: #User function Template for python3



class Solution:

    def findArea(self,A,B,C):

        #code here

Solutions:
from math import *

class Solution:

	def findArea(self, A, B, C):
		if A + B > C and A + C > B and (B + C > A):
			s = (A + B + C) / 2
			ar = (s * (s - A) * (s - B) * (s - C)) ** 0.5
			return ar
		else:
			return 0


class Solution:

	def findArea(self, A, B, C):
		if A + B > C and A + C > B and (B + C > A):
			a = 0
			s = (A + B + C) / 2
			a = (s * (s - A) * (s - B) * (s - C)) ** 0.5
			return a
		else:
			return 0


class Solution:

	def findArea(self, A, B, C):
		s = (A + B + C) / 2
		if A + B <= C or A + C <= B or B + C <= A:
			return 0.0
		else:
			return (s * (s - A) * (s - B) * (s - C)) ** 0.5


class Solution:

	def findArea(self, a, b, c):
		if a < 0 or b < 0 or c < 0 or (a + b <= c) or (a + c <= b) or (b + c <= a):
			return 0
		else:
			s = (a + b + c) / 2
			return (s * (s - a) * (s - b) * (s - c)) ** 0.5


class Solution:

	def findArea(self, a, b, c):
		s = (a + b + c) / 2
		area = s * (s - a) * (s - b) * (s - c)
		if area <= 0:
			return 0.0
		return area ** 0.5


import math

class Solution:

	def findArea(self, A, B, C):
		p = (A + B + C) / 2
		try:
			return round(math.sqrt((p - A) * (p - B) * (p - C) * p), 3)
		except ValueError:
			return 0.0


class Solution:

	def findArea(self, A, B, C):
		s = (A + B + C) / 2
		if s > A and s > B and (s > C):
			AR = (s * (s - A) * (s - B) * (s - C)) ** 0.5
			return AR
		else:
			return float(0)


class Solution:

	def findArea(self, A, B, C):
		if A < 0 or B < 0 or C < 0 or (A + B <= C) or (A + C <= B) or (B + C <= A):
			return 0
		S = (A + B + C) / 2
		findArea = (S * (S - A) * (S - B) * (S - C)) ** 0.5
		return findArea


class Solution:

	def findArea(self, A, B, C):
		s = (A + B + C) / 2
		if s - A >= 0 and s - B >= 0 and (s - C >= 0):
			g = (s * (s - A) * (s - B) * (s - C)) ** (1 / 2)
		else:
			return 0
		return g


class Solution:

	def findArea(self, A, B, C):
		if A + B > C and B + C > A and (A + C > B):
			x = (A + B + C) / 2
			y = x * (x - A) * (x - B) * (x - C)
			z = y ** 0.5
			return round(z, 3)
		else:
			return 0.0


class Solution:

	def findArea(self, a, b, c):
		if a + b <= c or a + c <= b or b + c <= a:
			return 0
		s = (a + b + c) / 2
		area = math.sqrt(s * (s - a) * (s - b) * (s - c))
		return area


class Solution:

	def findArea(self, A, B, C):
		(A, B, C) = (int(A), int(B), int(C))
		if A + B > C and B + C > A and (A + C > B):
			S = (A + B + C) / 2
			return (S * (S - A) * (S - B) * (S - C)) ** 0.5
		else:
			return 0


import math

class Solution:

	def findArea(self, A, B, C):
		s = (A + B + C) / 2
		x = s * (s - A) * (s - B) * (s - C)
		if x <= 0:
			return 0
		A = math.sqrt(x)
		if A == 0:
			return 0
		return A


import math

class Solution:

	def findArea(self, A, B, C):
		if A < 0 or B < 0 or C < 0 or (A + B <= C) or (B + C <= A) or (C + A <= B):
			return 0
		s = (A + B + C) / 2
		return (s * (s - A) * (s - B) * (s - C)) ** 0.5


class Solution:

	def findArea(self, A, B, C):
		S = (A + B + C) / 2
		A = S * (S - A) * (S - B) * (S - C)
		if A < 0:
			return 0.0
		return math.sqrt(A)
import math
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		(A, B, C) = map(int, input().strip().split(' '))
		ob = Solution()
		print('%.3f' % ob.findArea(A, B, C))


class Solution:

	def findArea(self, A, B, C):
		s = (A + B + C) / 2
		y = (s * (s - A) * (s - B) * (s - C)) ** 0.5
		if type(y) == type(complex(0)):
			return 0.0
		return y
import math
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		(A, B, C) = map(int, input().strip().split(' '))
		ob = Solution()
		print('%.3f' % ob.findArea(A, B, C))


class Solution:

	def findArea(self, A, B, C):
		s1 = A + B
		s2 = B + C
		s3 = C + A
		if A > s2 or B > s3 or C > s1:
			return 0
		else:
			S = (A + B + C) / 2
			p = S * (S - A) * (S - B) * (S - C)
			return p ** 0.5
import math
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		(A, B, C) = map(int, input().strip().split(' '))
		ob = Solution()
		print('%.3f' % ob.findArea(A, B, C))


class Solution:

	def findArea(self, a, b, c):
		if a < 0 or b < 0 or c < 0 or (a + b <= c) or (a + c <= b) or (b + c <= a):
			return 0
		s = (a + b + c) / 2
		area = (s * (s - a) * (s - b) * (s - c)) ** 0.5
		return area
import math
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		(A, B, C) = map(int, input().strip().split(' '))
		ob = Solution()
		print('%.3f' % ob.findArea(A, B, C))


import math

class Solution:

	def findArea(self, A, B, C):
		SumAB = A + B
		SumBC = B + C
		SumAC = A + C
		if A > SumBC or B > SumAC or C > SumAB:
			return 0
		s = (A + B + C) / 2
		return math.sqrt(s * (s - A) * (s - B) * (s - C))


class Solution:

	def findArea(self, A, B, C):
		if A + B <= C or C + B <= A or A + C <= B:
			return 0
		else:
			S = (A + B + C) / 2
			return math.sqrt(S * (S - A) * (S - B) * (S - C))


class Solution:

	def findArea(self, A, B, C):
		import math as m
		if A + B > C and A + C > B and (B + C > A):
			s = (A + B + C) / 2
			final = m.sqrt(s * (s - A) * (s - B) * (s - C))
			return final
		else:
			return 0.0


class Solution:

	def findArea(self, A, B, C):
		s = (A + B + C) / 2
		AREA = s * (s - A) * (s - B) * (s - C)
		if AREA <= 0:
			return 0
		return math.sqrt(AREA)


class Solution:

	def findArea(self, A, B, C):
		if A + B > C and B + C > A and (C + A > B):
			h = (A + B + C) / 2
			return math.sqrt(h * (h - A) * (h - B) * (h - C))
		else:
			return 0