Hello guys i have a small problem at my console application
i have a text file got
19862 line
String[] lines= File.ReadAllLines("C:\\Users\\ThElitEyeS\\Desktop\\PHP\\name\\names.txt");
int c = lines.Length;
int i = 1;
foreach (String line in lines) {
long f = ((i++ / c) * 100);
Console.WriteLine(f + "%");
}
the value always return 0%
except the last one its return 100%
and that is my problem i hope to find question fast 🙂
You are making a integer devision and that will be rounded.
Example:
Instead try
to force a floating point devision.