Saturday, April 29, 2023

find the area of a triangle

 //find the area  of a triangle 

#include "stdio.h"

#include "math.h"

int main ()

{

  float a,b,c,s,area;

printf("Enter the sides of triangle :\n");

scanf ("%f%f%f",&a,&b,&c);

s=(float)(a+b+c)/2;

area=sqrt(s*(s-a)*(s-b)*(s-c));

printf ("The ara of a triangle is %lf\n",area);

return 0;

}

               output                  output     

 Enter the sides of triangle :

3

4

5

The ara of a triangle is 6.000000              

No comments:

Post a Comment

print a multiplication table of any integer taking from user

 // print a multiplication table of any integer taking from user  #include "stdio.h" int main () { int n,mul,i; printf ("...