Click here to Skip to main content
16,009,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello my friends.. I have Users table with fields (likes (int) & dislikes (int)) ..

I have 500 users. user (A) has (likes = 80) & (dislikes = 30).

I want to evaluate this user (A) >> ( ... % ) upon number of likes and dislikes.

How could I do that ??
Posted
Comments
Thanks7872 3-Oct-13 4:49am    
Not clear at all.
Tejas Vaishnav 3-Oct-13 4:58am    
can you provide more information, based on your description it is not clear to understand your question. please use improve question functionality to add more details description.
Richard MacCutchan 3-Oct-13 5:03am    
likes - dislikes = overall_weighting. Repeat for all users and then calculate percentages.

1 solution

Hey there,

I see you want to calculate the percentage of Likes and Dislikes:

Here check this example:
C#
int likes = 80;
           int dislikes = 30;
           int c = likes + dislikes;
           double likesPerc = ((double)likes/ c) * 100;
           double dislikesPerc = ((double)dislikes / c) * 100;


Hope it helps

Azee...
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900