HOME

Start

Control Statements

Array

Function

Structure

Pointer

File

Projects

 

 

 

 

 

 

C programing

Ckalari.com is the No.1 website to get the best of C programs, free source codes, projects in c language……  

A C program  to Find distance between two points

#include<stdio.h>

#include<conio.h>

#include<math.h>

 struct line

  {

    struct point

    int x;

    int y;   

    }a,b;

  } l;

void main()

     {

    float d;

    clrscr();

    printf("Enter the co-ordinate of A\n");

    scanf("%d%d",&l.a.x,&l.a.y);

    printf("\nEnter the co-ordinate of B\n");

    scanf("%d%d",&l.b.x,&l.b.y);

         d=sqrt(((l.b.x-l.a.x)*(l.b.x-l.a.x))+((l.b.y-l.a.y)*(l.b.y-l.a.y)));

    printf("\n\n\nThe distance between A and B is %f",d);

    getch();

     }

Copyright © 2007-2008 www.ckalari.com