4 回答
TA贡献1812条经验 获得超5个赞
TotalParticipants=130+90=220
YesVotedParticipants=130
NoVotedParticipants=90
YesVotedPaticipants percent(%)= (YesVotedParticipants/TotalParticipants)*100
= (130/220)*100 =59.09 %
NoVotedPaticipants percent(%)= (NoVotedParticipants/TotalParticipants)*100
= (90/220)*100 =40.90 %
TA贡献1735条经验 获得超5个赞
是的百分比
Yes % = (total answers of yes / total ansers)*100
$yes = 130;
$no = 90;
$totals = $yes+$no;
$yes_per = ($yes/$totals) *100;
否的百分比
No % = (total answers of No / total ansers)*100
$no_per = ($no/$totals) *100
TA贡献1862条经验 获得超7个赞
这是你如何做到这一点
<?php
$yes = 130;
$no = 90;
$total_votes = $yes+$no;
if($total_votes > 0){
$yes_percentage = ($yes/$total_votes) *100;
$no_percentage = ($no/$total_votes) *100
}
else{
$yes_percentage = 0;
$no_percentage = 0;
}
- 4 回答
- 0 关注
- 152 浏览
添加回答
举报