#include<stdio.h>
int main(void)
{
float a, b, c;
a = b = c = 0;
float sum1 = 0.0f;
float sum2 = 0.0f;
float sum3 = 0.0f;
scanf("%f %f %f", &a, &b, &c);
for (int i = 1; i <= a; i++)
{
sum1 = sum1 + i;
}
for (int i = 1; i <= b; i++)
{
sum2 = sum2 + i * i;
}
for (int i = 1; i <= c; i++)
{
sum3 = sum3 + (1.0 / i);
}
float sum = sum1 + sum2 + sum3;
printf("%.2f\n",sum);
return 0;
}
求以下三数的和,保留2位小数 1到a之和,1到b的平方和, 1到c的倒数和
最新推荐文章于 2024-08-21 00:49:25 发布