C语言编写程序求和(急)
4个回答
展开全部
#include <stdio.h>
int main(void)
{
double sum = 0;
int i;
for (i = 1; i <= 50; i++)
sum += i;
for (i = 1; i <= 10; i++) {
sum += i * i * i;
sum += 1.0 / (i * i);
}
printf("sum = %lf\n", sum);
return 0;
}
int main(void)
{
double sum = 0;
int i;
for (i = 1; i <= 50; i++)
sum += i;
for (i = 1; i <= 10; i++) {
sum += i * i * i;
sum += 1.0 / (i * i);
}
printf("sum = %lf\n", sum);
return 0;
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2012-05-30
展开全部
#include <iostream>
using namespace std;
int main()
{
double sum = 0.0;
for (int k = 1; k <= 50; k++)
{
sum +=k;
}
for (int k = 1; k <= 10; k++)
{
sum +=k*k*k;
}
for (int k = 1; k <= 10; k++)
{
sum +=1.0/double(k*k);
}
cout<<sum<<endl;
return 0;
}
using namespace std;
int main()
{
double sum = 0.0;
for (int k = 1; k <= 50; k++)
{
sum +=k;
}
for (int k = 1; k <= 10; k++)
{
sum +=k*k*k;
}
for (int k = 1; k <= 10; k++)
{
sum +=1.0/double(k*k);
}
cout<<sum<<endl;
return 0;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
#include<stdio.h>
void main()
{
int i,j,sum1,sum_2;
float k,sum_3,sum;
for(i=1,sum_1=0;i<=50;i++)
sum_1=i+sum_1;
for(j=1,sum_2=0;j<=10;j++)
sum_2=i*i*i+sum_2;
for(k=1.0,sum_3=0.0;k<=10.0;k++)
sum_3=1.0/(k*k)+sum_3;
sum=sum_1+su_2+sum_3;
printf(sum="%.2f",sum);
}
void main()
{
int i,j,sum1,sum_2;
float k,sum_3,sum;
for(i=1,sum_1=0;i<=50;i++)
sum_1=i+sum_1;
for(j=1,sum_2=0;j<=10;j++)
sum_2=i*i*i+sum_2;
for(k=1.0,sum_3=0.0;k<=10.0;k++)
sum_3=1.0/(k*k)+sum_3;
sum=sum_1+su_2+sum_3;
printf(sum="%.2f",sum);
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2012-05-30
展开全部
#include <stdio.h>
#include <conio.h>
int main(void)
{
int k;
double sum = 0;
for (k = 1; k <= 50; k++)
sum += k;
for (k = 1; k <= 10; k++)
{
sum += k * k * k;
sum += 1.0f / (k * k);
}
printf("lf\n", sum);
}
#include <conio.h>
int main(void)
{
int k;
double sum = 0;
for (k = 1; k <= 50; k++)
sum += k;
for (k = 1; k <= 10; k++)
{
sum += k * k * k;
sum += 1.0f / (k * k);
}
printf("lf\n", sum);
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询