Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

!!Please use C. Language!! All sorts of data can be thought of as points in high

ID: 672937 • Letter: #

Question

!!Please use C. Language!!

All sorts of data can be thought of as points in high dimensional space. For example, a web page might be thought of as a point where each component is the number of words about a particular topic. For a bank, the components of the point might be related to your credit score and your debt to cash ratio, etc. No matter what a point represents, it's important to be able to compute how similar two points are. For this assignment: Create arrays for storing two points, both with 10 dimensions Ask the user to input the components of the two points print the distance between the two points Distance is computed the same as it is for points in 2 or 3 d: For 10-dimensional points u and v, the distance between them is: (u1-v1)^2 +(u2 -v2)^2 +(u3-v3)^2 +...+(u10-v10) Your program should output should look something like this:

Explanation / Answer

CODE:

#include<stdio.h>
#include<math.h>

int main()
{
   int i;
   double point1[10];
   double point2[10];

   double squareSum=0;

   printf("Please enter the 10 components of point 1 ");
   for(i=0;i<10;i++){
       scanf("%lf",point1[i]);
   }

   printf("Please enter the 10 components of point 2n ");
   for(i=0;i<10;i++){
       scanf("%lf",point2[i]);
   }
  
   for(i=0;i<10;i++){
       squareSum = squareSum + (point1[i] - point2[i]) * (point1[i] - point2[i]);
   }

   printf("the distance between points 1 and 2 is %lf ",sqrt(squareSum));
   return 0;
}