could someone please check this code and tell me where i went wrong... it always gives the result 1.00000 but as you can see in the for loop it shouldn't be like that.
#include <cstdio>
int main(void)
{
int n;
float s = 0;
scanf("%d", &n);
for(int i = 1; i <= n; i++)
{
if(i % 2 == 0) s -= 1/(i*i);
else s += 1/(i*i);
}
printf("%1.5f", s);
scanf("\n");
return 0;
}