Wether Given three sides a,b,c Form a Triangle or Not
Wether Given three sides a,b,c Form a Triangle or Not
#include<stdio.h>
#include<ctype.h>
#include<conio.h>
#include<math.h>
int main()
{
float a,b,c,A,B,C;
float s, Comm,Root_Comm,Sin_A,Sin_B,Sin_C ;
int Flag;
clrscr();
printf("Enter 3 sides of a Triangle A,B,C :");
scanf("%f %f %f",&a,&b,&c);
s=(a+b+c)/2;
printf("The Value of S is :%f\n",s);
Comm=s*(s-a)*(s-b)*(s-c);
printf("The Value of Comm is : %f\n",Comm);
Root_Comm=sqrt(Comm);
printf("Root of Comm is %f \n",Root_Comm);
Sin_A=2/(b*c)*Root_Comm;
Sin_B=2/(a*c)*Root_Comm;
Sin_C=2/(a*b)*Root_Comm;
printf("The Values are %f %f %f :\n",Sin_A,Sin_B,Sin_C);
printf("The Values are %f %f %f :\n",(a/Sin_A),(b/Sin_B), (c/Sin_C) );
A=a/Sin_A;
B=b/Sin_B;
C=c/Sin_C;
Flag=(A==B)?((A==C)?1:0):0;
if (Flag)
{ printf("Triangle is Valid : The Three Sides Form a Triangle ...\n");}
else
{ printf(" \n The Three Sides do not Form a Triangle ....\n");}
getch();
return(0);
}
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.