#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<math.h>
void main(){
int i,x1,x2,y1,y2,steps,xinc,yinc,dx,dy;
int gd=DETECT,gm;
initgraph(&gd,&gm,"C:\\TURBOC3\\BGI");
printf("Enter first x and y coor\n");
scanf("%d%d",&x1,&y1);
printf("Enter second x and y coor\n");
scanf("%d%d",&x2,&y2);
dx=x2-x1;
dy=y2-y1;
if(abs(dx)>abs(dy)){
steps=abs(dx);
}
else{
steps=abs(dy);
}
xinc=dx/steps;
yinc=dy/steps;
for(i=0;i<steps;i++){
if(i%2==0){
putpixel(x1,y1,3);
}
x1=x1+xinc;
y1=y1+yinc;
}
getch();
closegraph();
}