迭代平方根
Sample Input
4
Sample Output
2.000
见代码:
#include <stdio.h>
int main()
{
float a,b,c,n,m,j,sum1=0,sum2=0,sum3=0,sum=0;
scanf("%f%f%f",&a,&b,&c);
for(n=1;n<=a;n++)
sum1=sum1+n;
for(m=1;m<=b;m++)
sum2=sum2+m*m;
for(j=1;j<=c;j++)
sum3=sum3+1/j;
sum=sum1+sum2+sum3;
printf("%.2f\n",sum);
return 0;
}