5. Write a C program to calculate area of an equilateral triangle.
#include<stdio.h>
#include <math.h>
int main(){
float s, area;
printf("Enter side the triangle: ");
scanf("%f", &s);
area = (sqrt(3) / 4) * (s * s);
printf("Area of equilateral triangle = %.2f sq. units", area);
return 0;
}
Comments
Leave a comment