Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, i am confused with this question, can you help me? In C programming. Write a program vector_distance. c that: reads a positive integer n

Hi, i am confused with this question, can you help me? In C programming.

image text in transcribed
Write a program vector_distance. c that: reads a positive integer n . reads vector, of n integers po P1 ... Pn - 1 reads vectorz of n integers q0 91 ... In - 1 prints the Euclidean Distance between vector, and vectorz Match the example output below EXACTLY: dec -o vector_distance vector_distance.c ./vector_distance Enter vector length: 4 Enter vector 1: 3601 Enter vector 2: 2712 Euclidean distance = 2.000000 $ ./vector_distance Enter vector length: 5 Enter vector 1: 42 43 44 42 42 Enter vector 2: 42 43 44 42 42 Euclidean distance = 0.000000 s ./vector_distance Enter vector length: 1 Enter vector 1: 20 Enter vector 2: 10 Euclidean distance = 10 . 000000 ./vector_distance Enter vector length: 3 Enter vector 1: 12 3 Enter vector 2: 32 1 Euclidean distance = 2. 828427 s ./vector_distance Enter vector length: 6 Enter vector 1: 1 2 3 5 7 11 Enter vector 2: 31 29 23 19 17 13 Euclidean distance 48 . 259714 Hint: use two arrays to store the vectors Hint: use a while loop and scanf to read the integers into each array Hint: you will need #include at the top of vector_distance. c so you can call C's sqrt function. Assumptions/Restrictions/Clarifications. No error checking is necessary. You can assume n is a positive integer less than 1000. You can assume you are given two vectors of n integers. You can assume your input contains nothing but integers

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions