C Program to Find Area of an Isosceles Triangle

In this tutorial, i am going to show you how to find or calculate area of an isosceles triangle in c program.

All C Programs to Find Area of an Isosceles Triangle

  • C Program to Find Area of an Isosceles Triangle Using Formula
  • C Program to Find Area of an Isosceles Triangle using Function

C Program to Find Area of an Isosceles Triangle Using Formula

#include <stdio.h>
#include <math.h>
int main()
{
    float a, b, IsoArea;
    
    // Enter the Same Sides length
    printf("Enter Isosceles Triangle Length of a Side = ");
    scanf("%f",&a);
    printf("Enter Isosceles Triangle Other Side = ");
    scanf("%f",&b);
    IsoArea = (b * sqrt((4 * a * a) - (b * b)))/4;
    printf("The Area of the Isosceles Triangle = %.3f\n", IsoArea);
    
    return 0;
}

The result of the above c program; as follows:

Enter Isosceles Triangle Length of a Side = 8
Enter Isosceles Triangle Other Side = 10
The Area of the Isosceles Triangle = 31.225

C Program to Find Area of an Isosceles Triangle using Function

#include <stdio.h>
#include <math.h>
float IsoscelesArea(float a, float b)
{
    return (b * sqrt((4 * a * a) - (b * b)))/4;
}
int main()
{
    float a, b, IsoArea;
    
    printf("Enter Isosceles Triangle Length of a Side = ");
    scanf("%f",&a);
    printf("Enter Isosceles Triangle Other Side = ");
    scanf("%f",&b);
    IsoArea = IsoscelesArea(a, b);
    printf("The Area of the Isosceles Triangle = %.3f\n", IsoArea); 
    
    return 0;
}

The result of the above c program; as follows:

Enter Isosceles Triangle Length of a Side = 12
Enter Isosceles Triangle Other Side = 10
The Area of the Isosceles Triangle = 54.544

Be First to Comment

Leave a Reply

Your email address will not be published.