How to calculate percentage in c# -


i trying calculate percentage of given long value. following code returning 0 . how calculate percentage in c#

long value = (fsize / tsize) * (long)100; 

here fsize , tsize long values.

try this

var value = ((double)fsize / tsize) * 100; var percentage = convert.toint32(math.round(value, 0)); 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -