Alright, I\'m trying to calculate the percentage of two values. This should be really simple but for some weird reason it\'s not working. I\'m too tired/dumb to figure it ou
How about
int returnvalue = (int)(((double)FilesCompleted / TotalFilesCount) * 100);
What this is doing
Converting int FilesCompleted to double. For eg if its 295, then this will convert it into 295.0 so that division happens in double.
There is no need to convert TotalFilesCount to double also as divison of double by integer (or integer by double) returns a double.
So the returned double result is 0.011799056075513958 which is multipled by 100
So the retunred result is 1.1799056075513958 which is finally converted to int which returns 1