Toggle navigation
Courses
Questions
Tags
Users
AC 20161027 期中考 1
1
like
0
dislike
5.5k
views
請設計一程式,由使用者輸入N個數字,求這些數字的平均。使用者輸入的第一個數字N代表接下來會有多少個數字要求平均,接下來的N個數字就是需要計算平均的數。輸出請輸出到小數點後六位。
sample input:
10 1 2 3 4 5 6 7 8 9 10
sample output:
5.500000
[Exercise]
Coding (C)
-
asked
Oct 27, 2016
in
2016-1 程式設計(一)AC
by
Shun-Po
(
18k
points)
ID: 15378 -
Available when:
2016-10-27 18:30:00
-
Due to:
2016-10-27 21:00:00
edited
Oct 27, 2016
by
Shun-Po
|
5.5k
views
comment
0
1
Called for Help
0
0
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,n;
float c;
scanf("%d",&a);
int b[a];
for(n=0;n<a;n++)
{
scanf("%d",&b[n]);
}
for(n=0;n<a;n++)
{
c=c+b[n];
}
printf("%.6f",c/a);
return 0;
}
Please
log in
or
register
to add a comment.
102
Answers
0
like
0
dislike
Hidden content!#include<stdio.h>
int main()
{
*** * * * * * ** * * n= 0 ,i= 0 ,a= 0 ,j= 0 ,num[n];
** * * * * * ** * * ** * * ** ** * **
* ** ** **** * ** ** * *
* * * ** * * * * * * * ** ** 0 ;n<i;n++)
{
** * ** * *** * * * ** * *** * ** * ** * ** * ** ** * * ** * * ** **
*** ** * *** ** ** * *** *** * * * * * * * * * ** *
* ** * ** * **** * *
** ** *** ** * *
** * * * * * * * *** * * * * ** ** ***** *
**** * ** * * * * * ** ** * ** 0;
}
answered
Oct 27, 2016
by
m8f2617
(
-103
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!#include <stdio.h>
#include * ** **** * * **
int main()
{
* * *** ** ** * * * n,anynum,p,sum,ans;
* * * * * *** *** * * ** ** **** * * ** ** * * *
*** * **** * * * ******** * * (p = 0;p < n;p ++)
****** * ** ** * **** * *