SHARE
TWEET

Untitled

paradox88888888 Feb 17th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function divide(input) {
  2.  
  3. let n = Number (input[0]);
  4.  
  5. let p1 = 0;
  6. let p2 = 0;
  7. let p3 = 0;
  8.  
  9. for(let i = 1; i < n ; i++) {
  10.     let num = Number (input[i]);
  11.    
  12.     if (num % 2 == 0) {
  13.         p1++;
  14.     }if (num % 3 ==0) {
  15.         p2++;
  16.     }if (num % 4 ==0) {
  17.         p3++;
  18.    
  19.  
  20.     }
  21.    
  22. }
  23. console.log((p1 / n) * 100  + "%" ) ;
  24. console.log((p2 / n) * 100 + "%") ;
  25. console.log((p3 / n) * 100  + "%") ;
  26.  
  27. }
  28. divide(['10','680','2','600','200','800','799','199','46','128','65']);
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