Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdint.h>
- #include <inttypes.h>
- #include <time.h>
- #include <string.h>
- #include <math.h>
- extern float dot_product(int n, const float *x, const float *y);
- int main() {
- int n;
- scanf("%d", &n);
- float *x = calloc(n, sizeof(float));
- float *y = calloc(n, sizeof(float));
- for (int i = 0; i < n; i++) {
- scanf("%f", &(x[i]));
- }
- for (int i = 0; i < n; i++) {
- scanf("%f", &(y[i]));
- }
- float res = dot_product(n, x, y);
- printf("%f\n", res);
- free(x);
- free(y);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement