"Create a program that calculates the inner product of a vector, and the data is input from the keyboard."
I tried to do this but I got an error saying that it expects 'float' because there is 'double'.Perhaps you can help me out?
#include <stdio.h>
double main()
{
int i;
double a,b,c,x,y,z;
double ip = 0.0;
double u[] = {a,b,c};
double v[] = {x,y,z};
printf("enter vector here\n");
scanf("%f,%f,%f,%f,%f,%f",&a,&b,&c,&x,&y,&z);
for (i = 0;i < 3;i++)
{
ip = ip + u[i] * v[i];
}
printf("innerproduct%f\n",ip);
return 0;
}
1 reply to this topic
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









