1
I’d like to know, res
the value of the sequence and then print it? as for example, enter the value of N
equal to 2 and achieve output value 2.5?
#include <stdio.h>
int main (void)
{
int N,i;
float res;
scanf("%d", &N);
for( i = 1 ; i <= N; i++)
{
res = (float)i/((N - i) + 1);
}
printf("%.4f\n", res);
return 0;
}