习题2-4 子序列的和(subsequence)
程序员文章站
2024-03-18 23:30:10
...
#include <stdio.h>
int main()
{
int n,m;
int kase = 0;
while(scanf("%d%d",&n,&m) == 2 && ( n || m ))
{
double num;
double sum = 0;
for(int i=n;i<=m;i++){
num = (double) 1/i/i;
sum = num + sum;
}
printf("Case %d: %.5f\n",++kase,sum);
}
return 0;
}