# include double dran01 ( int *seed ); int main ( ) { double dot; int i; int seed = 123456789; // // X and Y are vectors. We don't know about these yet! // double x[10]; double y[10]; // // Fill X and Y with random values. // In C, the 10 entries of vector X are X[0], X[1], ... X[9]! // for ( i = 0; i < 10; i++ ) { x[i] = dran01 ( &seed ); y[i] = dran01 ( &seed ); } // // The dot product of two vectors is the sum of their pairwise products. // dot = 0.0; for ( i = 0; i < 10; i++ ) { dot = dot + x[i] * y[i]; } printf ( "\n" ); printf ( "The dot product is %g\n", dot ); return 0; }