#include <stdio.h>
#include <string.h>
int main()
{
float s=0;
int i, n;
printf("Quantity of terms:");
scanf("%f", &n);
for(i==0; i<=n-1; i++);
{
s=s+1/(i+1);
}
printf("Sum: %f", s);
return 0;
}
Hi. I'd like to sum up the series $1+1/2+...+1/n$, but I always get the sum zero... Could someone help me?
Thank you!
Quantity of terms:2
Sum: 0.000000
Process returned 0 (0x0) execution time : 7.953 s
Press any key to continue.