C program to find the area of a triangle, given three sides

by Nideesh C on April 11, 2011 · 0 comments

in C Programming




/*  C program to find the area of a triangle, given three sides*/

#include <stdio.h>
#include <conio.h>
#include <math.h>

void main()
{
int s, a, b, c, area;
clrscr();

printf(“Enter the values of a,b and c\n”);
scanf (“%d %d %d”, &a, &b, &c);

/* compute s*/

s = (a + b + c) / 2;

area = sqrt ( s * (s-a) * (s-b) * (s-c));

printf (“Area of a triangle = %d\n”, area);
}

/*—————————–
Output

Enter the values of a,b and c
3
4
5
Area of a triangle = 6
——————————*/

Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. Sample – Program to print the first 10 lines of pascal’s triangle.
  2. Sample – Program to find the roots of a quadratic equation.
  3. Sample – compute distance between cities
  4. Sample – Program to find the sum of each row & column of a matrix of size n x m and if matrix is square, find the sum of the diagonals also..
  5. Sample – compute square roots using Newton’s method

Leave a Comment

Previous post:

Next post: