Header Ads Widget

Python program to calculate the area of the triangle using formula at= root s(s-a)(s-b)(s-c)

 

Python program to calculate the area of the triangle using formula at= root s(s-a)(s-b)(s-c) 

Given sides of the triangle , write a program to calculate the area of the triangle . 

Sample input 

2 3 4

Sample output

Area of the triangle is: 2.90474

Python program to calculate the area of the triangle using formula at= root s(s-a)(s-b)(s-c)

The objective of the code is to calculate the area of the triangle . For calculating area of the triangle we will use the formula .



 Code(Python):-

import math
print("Enter sides of the triangle")
a,b,c=map(float,input().split())
s=(a+b+c)/2;
area=math.sqrt(s*(s-a)*(s-b)*(s-c));
print("Area of the triangle is: ",format(area,".2f"))

Output:-


Enter the sides of the triangle
2 3 4
Area of the triangle is : 2.90




Recommended Post :-

HCL Coding Questions:-

Capgemini Coding Questions:-

Companies interview:-

Full C course:-    

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-

Post a Comment

0 Comments