SHARE
TWEET

Untitled

a guest Feb 18th, 2020 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. finalsum = 0;
  3.  
  4. for j = 1:100
  5.    
  6.     total = 0;
  7.  
  8.     for i = 1:100000
  9.         randomnum = randi([-1 1]);
  10.         total = total + randomnum;
  11.     end
  12.  
  13.     finalsum = finalsum + total;
  14. end
  15.  
  16. finalsum = (finalsum/100000);
  17.  
  18. fprintf('The final value is %2.4f%% of the maximum possible value\n', finalsum)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top