image.png
#include <stdio.h>
int main()
{
//int i;
float i,s,s0=0,s1=0.0,s2=0;
for(i=1;i<=100;i++)
{
s0=s0+i;
if(i<=50)
s1=s1+i*i;
if(i<=10)
s2=s2+1/i;
}
s=s0+s1+s2;
printf("the answer is %f",s);
return 0;
}
网友评论