Skip to main content

To find area of triangle

PROCEDURE:-

      1.Input values for three sides of triangle
      2.find s value with the formulae (a+b+c)/2
      3.find area with the formulae sqrt(s(s-a)(s-b)(s-c))
      4.print the above result

CODE:-

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
  int a,b,c;
  float s, area;
  printf(“enter values for three sides of triangle”);
  scanf(“%d %d %d”, &a,&b,&c);
  s=(a+b+c)/2.0;
  area=sqrt(s*(s-a)*(s-b)*(s-c));
  printf(“\n area of triangle with sides a=%d, b=%d, c=%d  is  %f”, a,b,c,area);
}


Input :- enter values for three sides of triangle
            a=2, b=2, c=2
Output:- area of triangle with sides a=2, b=2, c=2  is  1.732

Comments

Popular posts from this blog

Find Value of S=ut+1/2*a*t**2.

PROCEDURE:-        1.enter values for u,a,t to find distance        2.find distance with the formulae ut+1/2at 2        3.print the above result CODE:- #include<stdio.h> #include<conio.h> void main() {   float u,t,a,S;   clrscr();   printf(“enter values u,t,a”);   scanf(“%f %f %f”, &u,&t,&a);   S=(u*t)+(0.5*a*t*t);   printf(“\n  S = %f”, S); } Input:- enter values u,t,a               U=10,t=4,a=4.9 Output:- S =79.200