The variables : "i" and "n" should be of integral type (such as int), not double.