Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. //calculate the amount of time
  2. int sum = 0;
  3. for(int i = 0; i < competitors.length; i++){
  4. sum += competitors[i];
  5. }
  6.  
  7. //avg
  8. double average = sum / competitors.length;
  9.  
  10. //calculate the standard deviation
  11. int round = 0;
  12. double x = 0;
  13. double standardDeviation;
  14. while(true){
  15. if(round == (competitors.length)){
  16. standardDeviation = Math.sqrt(x / competitors.length);
  17. break;
  18. }
  19. x = x + Math.pow(competitors[round] - average,2);
  20. round++;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement