Advertisement
bkit4s0

[lab3_0.c XLSS]

Mar 6th, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.25 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #define ARRAYSIZE 10000
  4. unsigned long long update(unsigned long long*,unsigned long long*,int);
  5. int main(int argc, char const *argv[])
  6. {
  7.     unsigned long long myArray1[ARRAYSIZE];
  8.     unsigned long long myArray2[ARRAYSIZE];
  9.     // Init vetor
  10.     for (int i = 0; i < ARRAYSIZE; ++i)
  11.     {
  12.         myArray1[i]=i;
  13.         myArray2[i]=i;
  14.     }
  15.     printf("%llu\n",update(myArray1,myArray2,ARRAYSIZE));
  16.     system("pause");
  17.     return 0;
  18. }
  19. unsigned long long update(unsigned long long a[],unsigned long long b[], int n)
  20. {
  21.     unsigned long long sum = 0;
  22.     for (int i = 0; i < n; ++i)
  23.     {
  24.         sum+=a[i]*b[i];
  25.     }
  26.     return sum;
  27. }#include <stdio.h>
  28. #include <stdlib.h>
  29. #define ARRAYSIZE 10000
  30. unsigned long long update(unsigned long long*,unsigned long long*,int);
  31. int main(int argc, char const *argv[])
  32. {
  33.     unsigned long long myArray1[ARRAYSIZE];
  34.     unsigned long long myArray2[ARRAYSIZE];
  35.     // Init vetor
  36.     for (int i = 0; i < ARRAYSIZE; ++i)
  37.     {
  38.         myArray1[i]=i;
  39.         myArray2[i]=i;
  40.     }
  41.     printf("%llu\n",update(myArray1,myArray2,ARRAYSIZE));
  42.     system("pause");
  43.     return 0;
  44. }
  45. unsigned long long update(unsigned long long a[],unsigned long long b[], int n)
  46. {
  47.     unsigned long long sum = 0;
  48.     for (int i = 0; i < n; ++i)
  49.     {
  50.         sum+=a[i]*b[i];
  51.     }
  52.     return sum;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement