include<stdio.h>
#include<conio.h>
#include<math.h>
#include<process.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"e:\\tc\\bgi");
float xf=0.0;
float yf=5.0;
float xb;
float yb;
int t,vf,T;
float DIST,dis;
vf=20;
printf("enter intial( xf, yf):");
scanf("%f ",&xf,&yf);

t=0;
while(t<=12)
{ printf("enter the point of bomber(xb,yb) from the table :\n");
//scanf("%f",&xb);
//scanf("%f",&yb);

DIST=sqrt((xf-xb)*(xf-xb)+(yf-yb)*(yf-yb));

dis=DIST;
T=t;
putpixel((int)xb,(int)yb,10);
putpixel((int)xf,(int)yf,10);
if(DIST<=10)
{
printf(" DIST %f",dis);
printf(" the time= %d",T);
exit(0);
}
else
{
xf=xf+vf*((xb-xf)/DIST);
yf=yf+vf*((yb-yf)/DIST);
t=t+1;
}
}
printf("targer escaped");
getch();
}
