```
#include<stdio.h>
#include<math.h>
#include<conio.h>
#include<graphics.h>
void main()
{
float x1,x2,y1,y2,x,y,dx,dy,pixel;
int i,gd=DETECT,gm;
initgraph(&gd,&gm,"");
printf("Enter x-coordinate for initial point: ");
scanf("%f",&x1);
printf("Enter y-coordinate for initial point: ");
scanf("%f",&y1);
printf("Enter x-coordinate for final point: ");
scanf("%f",&x2);
printf("Enter y-coordinate for final point: ");
scanf("%f",&y2);
dx=abs(x2-x1);
dy=abs(y2-y1);
if(dx>=dy)
pixel=dx;
else
pixel=dy;
x=x1;
y=y1;
i=1;
while(i<pixel)
{
putpixel(x,y,1);
x=x+dx;
y=y+dy;
i=i+1;
}
getch();
closegraph();
}
```