I have the following code:
float fl = ((float)20701682/(float)20991474);
And that gives me fl = 0.9861948.
I would like to convert 0.9861948 to 2% since 2% has been downloaded.
I’m downloading a file and calculating progress.
Any help would be grate.
I guess you mean something like
to calculate the percentage.
But for
fl = 0.9861948this gives1(1.38052casted to int).If you want
2instead, you could useMath.ceil: