Question

Collassa Question 2 Not yet ansered Merced out of 2000 OP Write a program to calculate the distance between the two points. N
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code:

#include <stdio.h>

#include<math.h>

int main()

{

    double x1, x2, y1, y2;

    double d, x, y;

    printf("Input x1: ");

    scanf("%lf", &x1);

    printf("Input y1: ");

    scanf("%lf", &y1);

    printf("Input x2: ");

    scanf("%lf", &x2);

    printf("Input y2: ");

    scanf("%lf", &y2);

    x = (x2-x1);

    y = (y2-y1);

    d = sqrt(x*x + y*y);

    printf("\nDistance between said points: %.4lf", d);

    return 0;

}

Output:

main.c 1 #include <stdio.h> 2 #include<math.h> 3 int main() 4-{ 5 double x1, x2, yi, y2; 6 double d, x, y; 7 printf(Input x1

Add a comment
Know the answer?
Add Answer to:
Collassa Question 2 Not yet ansered Merced out of 2000 OP Write a program to calculate...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT