Our Blog Contain Detail about Some Technical Aspect like Programming, Blogger, Tools and Tip, Suggestion, Motivational, Health, Program in C and Java, Html

Write a program to calculate the area of triangle using formula at=√s(sa)(s-b)(s-c)


 Write a program to calculate the area of triangle using formula at=√s(sa)(s-b)(s-c)



Index 
  • Introduction 
  • Algorithm of give Problem 
  • Flow Chart
  • Program in C language 
  • Out put 

Introduction 

In this Problem Statement we have to calculate the area of triangle using Heron’s Formula

at=√s(s-a)(s-b)(s-c)

where a, b , c are the side of triangle

S =(a+b+c)/2 it is semi Perimeter

There logic is that first of all we are going to take input from the user in order to calculate the value of area of triangle

so see the algorithm for above problem statement

Algorithm of give Problem

Input: Three side of triangle 
Output: Area of triangle using given formula

Step1: Take the side of triangle as input from user let a, b, s.
Step2: Now Calculate the value of S using below formula

            S =(a+b+c)/2

 Step3: Now calculate the value of area of triangle using below formula

          Area = sqrt(S * (S-a) * (S-b) * (S-c));

Note: in order to calculate Square Root we make use of Function Sqrt
from header file math.h

Step4: Print the value of Area
Step5: Exit.

Flow Chart







Program in C language

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

void main()
{
     double a,b,c,at,temp,S;

     printf("Enter the size of side of triangle\n");
     scanf("%lf %lf %lf",&a,&b,&c);
     S=(a+b+c)/2;
     temp=S*(S-a)*(S-b)*(S-c);
     at=sqrt(temp);
     printf("Area of triangle is %3.2lf",at);

     getch();
}


Out Put




Share:

No comments:

Post a Comment

Translate

Followers

Email Subscription

Enter your email address:

Delivered by FeedBurner

Recent Posts

Theme Support

Need our help to upload or customize this blogger template? Contact me with details about the theme customization you need.