#include<stdio.h>
#include<math.h>
int main() {
int s1, s2, angle;
float area;
printf("\nEnter Side1 : ");
scanf("%d", &s1);
printf("\nEnter Side2 : ");
scanf("%d", &s2);
printf("\nEnter included angle : ");
scanf("%d", &angle);
area = (s1 * s2 * sin((M_PI / 180) * angle)) / 2;
printf("\nArea of Scalene Triangle : %f", area);
return (0);
}
Output :
Enter Side1 : 3
Enter Side2 : 4
Enter included angle : 30
Area of Scalene Triangle : 3.000000
Area of Scalene Triangle
Properties of Scalene Triangle :
- Scalene Triangle does not have sides having equal length.
- No angles of Scalene Triangle are equal.
- To calculate area we need at least two sides and the angle included by them.
Formula to Find Area of Scalene Triangle :
Explanation and Program Logic :
Part 1 : M_PI
- It is Constant defined in math.h Header File
- It contain value = 3.14 in short instead of writing 3.14 write directly M_PI.
Part 2 : ( M_PI / 180 ) * angle
- We are accepting angle in degree.
- C function sin takes argument in radian , so to convert angle into radian we are purposefully writing above statement.
Part 3 : sin function
- It computes sine of an angle
Its very good explanation Vijay Thank you
ReplyDelete