Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5.  
  6. void main(){
  7.  
  8.  
  9. int arr1[1000];
  10. int arr2[1000];
  11. int arr3[1000];
  12.  
  13. int max = 1000;
  14. int min = -1000;
  15.  
  16. time_t t;
  17.  
  18. int sum = 0;
  19.  
  20. int i;
  21.  
  22. srand(time(&t));
  23.  
  24. for(i=0;i<1000;i++){
  25.  
  26. arr1[i] = rand() % 2000 - 1000;
  27. arr2[i] = rand() % 2000 - 1000;
  28. }
  29.  
  30. for(i=0;i<1000;i++){
  31. arr3[i] = arr1[i] + arr2[i];
  32. }
  33.  
  34. for(i=0;i<1000;i++){
  35. sum += arr3[i];
  36. }
  37.  
  38. printf("The sum of the third array is %d \n", sum);
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement