Zo Has Zo Has - 1 year ago 141
C# Question

Division returns zero

I am having this simple calculation returning zero can't figure it out

decimal share=(18 / 58)*100;

Answer Source

You are working with integers here. Try using decimals for all the numbers in your calculation.

 decimal share = (18m/58m)*100m;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download