C
Programming and Technical
Programming
Arrays
you must implement the function isTriangle( Point *P1,Point *P2,Point *P3) to accept three points as inputs and checks wether the given three points form vertices of triangle.
If They form a triangle then function returns 1 else function returns 0
use point structure.
int isTriangle( Point *P1,Point *P2,Point *P3)
{
// write your code here
}
Read Solution (Total 4)
-
- int isTriangle( Point *P1,Point *P2,Point *P3)
{
*p1=s1;
*p2=s2;
*p3=s3; //where s1,s2,s3 are sides of the triangle
if( *p1 - 5 years agoHelpfull: Yes(26) No(17)
- printf("Enter the sides of the triangle",P1,P2,P3);
P1+P2+P3=180; - 5 years agoHelpfull: Yes(3) No(5)
- if(*P1+*P2+*P3==180)
printf("forms vertices of triangle");
else
printf("not form triangle"); - 5 years agoHelpfull: Yes(1) No(2)
- int isTriangle(Point* p1, Point* p2, Point* p3) {
double AB = p1->Distance(p2);
double AC = p1->Distance(p3);
double BC = p2->Distance(p3);
if ((AB + AC > BC) && (AB + BC > AC) && (AC + BC > AB))
return 1;
else
return 0; - 3 years agoHelpfull: Yes(0) No(1)
C Other Question