C program to find area of an isosceles triangle; Through this tutorial, we will learn how to find or calculate area of an isosceles triangle in c program.
Programs to Find Area of an Isosceles Triangle in C
- 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 Output 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 Output 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