Area of the Triangle || Heron's formula || Functions in C || Arguments and Returns a value || C Programming
In this, we are going to see the Functions that have arguments and returns a value, this program we are going to find area of the triangle using heron's formula in C Programming Language.

 


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

float display_output(float a, float b, float c)
{
    float s, area;
    s = ((a + b + c) / 2);
    area = sqrt(s * (s - a) * (s - b) * (s - c));
    return area;
}

float main()
{
    system("cls");
    float a, b, c;
    printf("Enter the sides of the triangle: \n");
    printf("a = ");
    scanf("%f", &a);
    printf("b = ");
    scanf("%f", &b);
    printf("c = ");
    scanf("%f", &c);
    printf("Area of the triangle is:  %f", display_output(a, b, c));

    return 0;
}

//.......Coded by JAIDEEP JAMBLE

#ENJOY CODING

Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post