//Area = (√3)/4 * s² (S = Any side of the Equilateral Triangle)
#include<stdio.h>
int main()
{
float side;
scanf("%f", &side);
area = (sqrt(3) / 4) * (side * side);
printf("Area of equilateral triangle = %.2f sq. units", area);
//%.2f is used to print fractional values only up to 2 decimal places. You can also use %f to print up to 6 decimal places by default.
return 0;
}
Input:
75
Output:
Area of equilateral triangle = 2435.69 sq. units
#include<stdio.h>
int main()
{
float side;
scanf("%f", &side);
area = (sqrt(3) / 4) * (side * side);
printf("Area of equilateral triangle = %.2f sq. units", area);
//%.2f is used to print fractional values only up to 2 decimal places. You can also use %f to print up to 6 decimal places by default.
return 0;
}
Input:
75
Output:
Area of equilateral triangle = 2435.69 sq. units
No comments:
Post a Comment