Sajid loves super heroes he used to imagine himself to be a hero. One day his teacher was taking a class about shapes and asked the students to find the Area of the triangle using Heron’s formula.
Sajid misheard this as Hero’s formula and was curious to discover the Hero’s formula for finding the area of the triangle.
Help Sajid to solve his math problem by using the correct logic in your code.
Functional Description:
Area = sqrt(s(s – a)(s – b)(s – c)), where
s = (a + b + c) / 2 and
a, b & c are the sides of triangle.
Input:
Input has 3 integers representing 3 side of the triangle
Output:
Print the area of the triangle with only two values after the decimal point
#include <stdio.h> #include <math.h> int main() { int a,b,c; float s,area; scanf("%d %d %d",&a,&b,&c); s=(a+b+c)/2; area=sqrt(s*(s-a)*(s-b)*(s-c)); printf("%.2f\n",area); return 0; }
INPUT_1:
5 5 4
OUTPUT:
9.17
INPUT_2:
6 5 4
OUTPUT:
6.48
INPUT_3:
10 15 20
OUTPUT:
60.79
INPUT_4:
22 23 20
OUTPUT:
185.90
Morae Q!
- Convert seconds to hours – HMS format.
- Find out the tax amount of the bill with tip for the meal.
- Find the area of the pyramid.
- Find the area of triangle using heron’s formula.
- Find the interest and amount resided in the bank.
- Convert the travel days to years and months.
- Find the first three powers of N number.
- Compute the height from feet and inches to centimetres.
- Calculate the amount of interest earned in the bank.
- Find the ways they can choose the sequence of dummy statues.
- Find the Lapindrome strings.
- Classify the salary of a person.
- Find the day on providing the week number.
- Find the least number of marble stones needed to pave the square mall.
- Find the number of steps on chessboard performed to satisfy a condition.
- Find the time, hours and minutes the train was delayed.
- Find the quantity of food packets shared and available.
- Compute all Arithmetic Operations.
- Find the amount to pay for the electricity bill.
- Find the sum of numbers with three values after decimal point.