Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
Calculate reputation percentage based on negative and positive

I have users which can receive up-votes on their posts. Example: 5 users upvote 2 users downvote. I need to calculate the percentage of positive feedback.

I try with this code:

$result=(($positive-$negative)/$negative);
$r = ($result*100);
$result = $r / 100;

The code above does not work because if i have 50 upvotes and 1 downvote, The percentage results in 49%.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If 50 votes is 100%, you need to calculate percentage for 49 votes. Here is the math:

/* 50(votes) / 100% = 49(votes) / $x% */
$x = 100 x 49 / 50;

Which is 98%

For 5 upvotes and 2 down votes you can use the same logic:

$x = 100 x 3 / 5;

Which is 60%

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!