KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have two integers that I want to divide to get a percentage. This is what I have right now: int mappedItems = someList.Count(x => x.Value != null); int totalItems = someList.Count(); (int)(((double)mappedItems /(double) totalItems) * 100) This gives the right answer. But that is a lot of casting to do something as simple as get a percentage between two numbers. Is there a better way to do this? Something that does not involve casting?
Tags (comma-separated)
Save Edits
Cancel