Posted by: naivelyStupid February 14, 2010
Login in to Rate this Post:
0
?
double sum, i;
for (i = 1, sum = 0; i <= 100000000; i++);
sum = sum + 1/i;
cout << "Sum is " << sum << endl;
remove the semicolon at the end of the second line or else write it as
for (i = 1, sum = 0; i <= 10; sum+=1/i, i++);