The deadline of submission is February 15th Acceptable file

The deadline of submission is February 15th. Acceptable file format for submission is C source file, not a text file, archive file, word document or executable file. Check your program carefully before submission. Test data differs from the sample input will be used in the grading. Make sure your program work properly for all possible eases. You just need to fill the content of hw2.c, do not change the form of the function. It is fine that the main function remains blank. Finish the following functions in hw2.c. void vector input (float v[], int n): input the elements of vector v and store in the array. void vector output (float v[], int n): output the elements of vector v on the screen. void vector_add(float v1[], float v2[].float v3[], int n): calculate the sum of vector v1 and v2 and store the result in v3. The sum is a vector, not a single value. void vector multiply (float v[].int n.float x): multiply each element in v by x float inner .product (float v1[], float v2[], int n): return the inner product of vector r1 and v2. float length(float v[], int n): return the length of vector v vector add: (1.2, 3.5, 5.7) + (3.2, 1, 6.3)=(4.4, 4.5, 12) vector multiply: (2.2, 4.1, 6.5) times 3=(6.6, 12.3, 19.5) inner .product: (1, 2, 3) - (4.5, 6)=1 times 4 + 2 times 5 + 3 times 6 = 4 + 10 + 18 = 32 length: length of vector (3, 4, 5) is Squareroot 9 + 16 + 25 = Squareroot 50 = 7.071068

Solution

#include <stdio.h>
#include <math.h>
void vector_input(float v[],int n);
void vector_output(float v[],int n);
void vector_add(float v1[],float v2[],float v[3], int n);
void vector_multiply(float v[],int n,float x);
void inner_priduct(float v[],float v2[],int n);
int main()
{
float v[25];
float v2[25];
float v3[25];
int i,N;
float x;
printf(\"Enter the size of array:-\ \");
scanf(\"%d\", &N);
vector_input(v,N);
vector_output(v,N);
vector_add(v,v2,v3,N);
printf(\"Enter an element X to multiply vector V:-\ \");
scanf(\"%f\",&x);
vector_multiply(v,N,x);
inner_priduct(v,v2,N);
}
void vector_input(float v[],int N){
int i;
printf(\"Enter array elements of array \\\"V1\\\":-\ \");
for(i=0;i<N;i++){
scanf(\"%f\", &v[i]);
}
}
void vector_output(float v[],int N){
int i;
printf(\"Entered elements of array \\\"V1\\\" are:-\ \");
for(i=0;i<N;i++){
printf(\"%f\ \", v[i]);
  
}
}
void vector_add(float v1[],float v2[],float v3[],int N){
int i;
printf(\"Enter array elements of array \\\"V2\\\" to add in \\\"V1\\\":-\ \");
for(i=0;i<N;i++){
scanf(\"%f\", &v2[i]);
}
for(i=0;i<N;i++){
v3[i]=v1[i]+v2[i];
}
printf(\"sum of v1 and v2 are:-\ \");
for(i=0;i<N;i++){
printf(\"%f\ \", v3[i]);
}
}
void vector_multiply(float v[],int N,float x){
int i;
printf(\"Vector V after multiplying each element by X:-\ \");
for(i=0;i<N;i++){
float multiply=v[i]*x;
printf(\"%f\ \",multiply);
}
}
void inner_priduct(float v[],float v2[],int N){
int i;
float sum=0;
for(i=0;i<N;i++){
float multiply=v[i]*v2[i];
sum+=multiply;
}
printf(\"Inner product is:- %f\ \",sum);
}

 The deadline of submission is February 15th. Acceptable file format for submission is C source file, not a text file, archive file, word document or executable
 The deadline of submission is February 15th. Acceptable file format for submission is C source file, not a text file, archive file, word document or executable

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site