#include<stdio.h>#include<conio.h>#include<graphics.h>#include<dos.h>#include<math.h>
void main(){ int i,x1,x2,y1,y2,p,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; p=2*dy-dx; while(x1<=x2){ putpixel(x1,y1,3); x1++; if(x1%2==0){ if(p<0){ p=p+2*dy; } else{ p=p+2*dy-2*dx; y1++; delay(60); } } } getch(); closegraph();}