using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace QuestionEight { class Program { static void Main(string[] args) { const int N = 100; double sum = 0; for (int i = 1; i <= N; i++) { sum = sum +1.0/i ; // <-- change this to sum = sum+1/i; } Console.WriteLine("Sum ={0}", sum); } } }
int i
sum
double
i
(double)i
1d
1.0d
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)