How can u say that a given point is in a triangle?
1. with the co-ordinates of the 3 vertices specified.
2. with only the co-ordinates of the top vertex given.
solution for 1st case:
Given:(x1,y1),(x2,y2),(x3,y3),the co-ordinates of the
vertices of the triangle.
Let (xx,yy) be the pt to be located.
Find the equations of the lines {(x1,y1),(x2,y2)} and
{(x1,y1)(x3,y3)} using the formula
((y-y1)/(y2-y1))=((x-x1)/(x2-x1))
Now substitute the y value in the 2 equations got. You 'll
be getting the x limits. If the given x value lies within
the limits you have found,the given pt is within the
triangle or else it is not.
| Is This Answer Correct ? | 5 Yes | 0 No |
write a program in c language to get the value of arroy keys pressed and display the message which arrow key is pressed?
main() { int i=5; printf("%d",++i++); }
main() { int i=400,j=300; printf("%d..%d"); }
Given a list of numbers ( fixed list) Now given any other list, how can you efficiently find out if there is any element in the second list that is an element of the first list (fixed list)
3 Answers Disney, Google, ZS Associates,
void main() { int x,y=2,z; z=(z*=2)+(x=y=z); printf("%d",z); }
write a origram swaoing valu without 3rd variable
write a simple calculator c program to perform addition, subtraction, mul and div.
0 Answers United Healthcare, Virtusa,
int i; main(){ int t; for ( t=4;scanf("%d",&i)-t;printf("%d\n",i)) printf("%d--",t--); } // If the inputs are 0,1,2,3 find the o/p
Cluster head selection in Wireless Sensor Network using C programming language.
#include <stdio.h> #define a 10 main() { #define a 50 printf("%d",a); }
hello sir,is there any function in C that can calculate number of digits in an int type variable,suppose:int a=123; 3 digits in a.what ll b answer?
main() { int i=5,j=6,z; printf("%d",i+++j); }