We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
functionplusMinus($arr){// Write your code here$total=count($arr);$positive=0;$nagetive=0;$zero=0;foreach($arras$val){if($val==0){$zero++;}elseif($val>0){$positive++;}elseif($val<0){$nagetive++;}}print_r($positive/$total);print_r("\n");print_r($nagetive/$total);print_r("\n");print_r($zero/$total);}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Plus Minus
You are viewing a single comment's thread. Return to all comments →
Php Solutions