- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

- Read all the three sides of the triangle and store them in three separate variables.
- Using the Heron's formula, compute the area of the triangle.
- Print the area of the triangle.

Enter first side: 15 Enter second side: 9 Enter third side: 7 Area of the triangle is: 20.69 | Enter first side: 5 Enter second side: 6 Enter third side: 7 Area of the triangle is: 14.7 |

- User must enter all three numbers and store them in separate variables.
- First, the value of s is found which is equal to (a+b+c)/2
- Then, the Heron's formula is applied to determine the area of the triangle formed by all three sides.
- Finally, the area of the triangle is printed.

package main import ( "fmt" "math" ) func main(){ var a, b, c float64 fmt.Print("Enter first side of the triangle: ") fmt.Scanf("%f", &a) fmt.Print("Enter second side of the triangle: ") fmt.Scanf("%f", &b) fmt.Print("Enter third side of the triangle: ") fmt.Scanf("%f", &c) s:=(a+b+c)/2 area:=math.Sqrt(s * (s - a) * (s - b) * (s - c)) fmt.Printf("Area of the triangle is: %.2f", area) }

Enter first side of the triangle: 15 Enter second side of the triangle: 9 Enter third side of the triangle: 7 Area of the triangle is: 20.69

- Related Questions & Answers
- Calculating the area of a triangle using its three sides in JavaScript
- Java program to find the area of a triangle
- Find area of triangle if two vectors of two adjacent sides are given using C++
- C++ program to find the Area of the circumcircle of any triangles with sides given?
- Golang Program to Find the Area of a Rectangle Using Classes
- Find the hypotenuse of a right angled triangle with given two sides in C++
- Golang Program to find the parity of a given number.
- Java Program to find all angles of a triangle
- C++ program to find the Area of the Largest Triangle inscribed in a Hexagon?
- Area of the circumcircle of any triangles with sides given in C++
- Find area of parallelogram if vectors of two adjacent sides are given using C++.
- Find other two sides of a right angle triangle in C++
- C++ Program to Compute the Area of a Triangle Using Determinants
- Area of Reuleaux Triangle?
- Write a Golang program to find the factorial of a given number (Using Recursion)

Advertisements