- S=1/(12)+1/(23)+1/(34)+…+1/(n(n+1))
int n;
float i,j,sum=0;
printf(" nhap n= ");
scanf("%d",&n);
for(i=1;i<=n;i++){
for(j=1;j<=i+1;j++){
sum += 1/(i*j);
}
}
printf(" s=%.5f",sum);
- s=(1^2+2^2+3^2+n^2)/n^3
int n;
float i, sum=0;
printf("nhap n ");
scanf(" %d",&n);
for(i=1;i<=n;i++){
sum +=pow(i,2)/pow(i,3);
}
printf(" s=%.4f",sum);