# 第七周作业

---恢复内容开始---

 1 #include <stdio.h>
2 int main()
3 {
4     int n,d,f;
5     double sum,a;
6     a = 1;
7     d = 1;
8     scanf("%d",&n);
9     for(f = 1;f <= n;f ++)
10     {
11         sum = sum + a * f /d;
12         a = -a;
13         d = d + 2;
14     }
15     printf("%.3lf",sum);
16 }

 1 #include <stdio.h>
2 int main()
3 {
5   double average ;
6   scanf("%d",&N);
7   if(N= 0);
8   else
9   {
10     for(i=1;i<=N;i++)
11     {
15       count++;
16       else
17       count=count;
18     }
19     average=(sum*1.0f)/(N*1.0f);
20   }
21   printf("average = %.1f\n count = %d",average,count);
22   return 0;
23 }

---恢复内容结束---

 1 #include <stdio.h>
2 int main()
3 {
4     int n,d,f;
5     double sum,a;
6     a = 1;
7     d = 1;
8     scanf("%d",&n);
9     for(f = 1;f <= n;f ++)
10     {
11         sum = sum + a * f /d;
12         a = -a;
13         d = d + 2;
14     }
15     printf("%.3lf",sum);
16 }

 1 #include <stdio.h>
2 int main()
3 {
5   double average ;
6   scanf("%d",&N);
7   if(N= 0);
8   else
9   {
10     for(i=1;i<=N;i++)
11     {
15       count++;
16       else
17       count=count;
18     }
19     average=(sum*1.0f)/(N*1.0f);
20   }
21   printf("average = %.1f\n count = %d",average,count);
22   return 0;
23 }

第一步:使成绩数目，成绩数量，成绩和成绩总量为整形；

表格

posted @ 2017-11-16 17:55  莯菸  阅读(195)  评论(4编辑  收藏  举报