Find the area of triangle (length of arms are given) - Shyam IT Guru  

A complete Site for Information Technology

मैं आपको इस ब्लॉग में आने के लिए dhanyabad कहता हूं। जय हिंद, वंदे मातरम् ❤❤

Find the area of triangle (length of arms are given)

Hi,
If the arm length of any triangle are given. We can find the area of that triangle by following source code.

Here I would like to tell you something about integers and floats I have used so far in this program

Int a, b, c; are used for the arm length of triangle. User will submit these values.


S=(a+b+c) /2
D=√s(s-a) (s-b) (s-c)

We have to find out D.


Source code:





 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
    int a,b,c;
    float d,e,s;
    printf("enter value of a b and c");
    scanf("%d %d %d", &a, &b, &c);
    s=(a+b+c)/2;
    e=s*(s-a)*(s-b)*(s-c);
    d=pow(e, 0.5);
    printf("%f", d);
    
    getch();
    return 0;
}


Learn c programming in hindi 


कोई टिप्पणी नहीं:

एक टिप्पणी भेजें