C Program to find area of triangle using Heron’s Formula

Write a Program in C programming language to find the area of triangle using Heron’s formula. Below is the code of the C program –


/* C program to find area of trianlge using Heron's formula */

#include<stdio.h>
#include<math.h>
void main()
{
     float a,b,c,s=0,area=0;
     
     printf("Enter the length of sides of triangle \n");
     scanf("%f %f %f",&a,&b,&c);
     
     s = (a+b+c)/2.0; /* s is semi-perimeter */
     area = (sqrt)(s*(s-a)*(s-b)*(s-c));
     
     printf("Area of triangle =\t %f",area);
     getch();
}

Input –
a = 6
b = 4
c = 5

Output-

Area of triangle = 9.9215

 

yashan has written 69 articles

2 thoughts on “C Program to find area of triangle using Heron’s Formula

  1. Kacey says:

    I see a lot of interesting articles on your website.
    You have to spend a lot of time writing, i know how to save you a lot of work, there is a tool that creates unique,
    google friendly posts in couple of seconds, just type in google – laranita’s free content source

  2. Ted says:

    I read a lot of interesting content here.
    Probably you spend a lot of time writing, i know how to save you a lot of
    time, there is an online tool that creates unique, google friendly posts in seconds, just search in google – laranitas free content

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>