Calculating whole percentages
So, I would like to calculate the percentage stroke of my program as the nearest integer value
In my examples, you can take
int FilesProcessed = 42;
int TotalFilesToProcess = 153;
So, first I tried:
Int TotalProgress = ((FilesProcessed / TotalFilesToProcess) * 100)
It brought back TotalProgress = 0
Then I tried
Int TotalProgress = (int)((FilesProcessed / TotalFilesToProcess) * 100)
This gives a compiler error saying Cannot implicitly convert type decimal to int
Ive tried
Int TotalProgress = Math.Round((FilesProcessed / TotalFilesToProcess) * 100)
and get The call is ambiguous between decimal and double
and so now I came here for help?
+3
source to share