为了账号安全,请及时绑定邮箱和手机立即绑定

一道很简单的求平均数的问题

一道很简单的求平均数的问题

C
晴书 2016-12-07 20:01:50
我的程序一直报错我是新手 大神可以帮我看看嘛
查看完整描述

1 回答

已采纳
?
Yexiaomo

TA贡献152条经验 获得超157个赞

#include <stdio.h>
int main(){
	int n,i,a;
	float sum;
	while(scanf("%d", &n) != EOF && n > 0){
		sum = 0;
		for(i = 1; i <= n; ++i){
			scanf("%d", &a);
			sum+=a;
		}
		printf("%.2f\n", sum/n);
	}
	return 0;
}

看着能不能通过, 过不去了, 把错误提示贴上来

-----

头文件应导入: stdio.h

数组没有必要定义

查看完整回答
反对 回复 2016-12-07
?
慕瓜9220888

TA贡献868条经验 获得超0个赞

LJBRQHFWG

YWLUNQADD

ZIUJJQYOQ

OWTLRIQKB

DTZIRYOEP

LQILAHYLF

FUVNWTKHI

QPXIXULSJ

GEJMVURHI

WVXWFYVLF

PEWFSFCZI

ZOOATQWHH

CGWZRVIVV

CGQSRSCMG

WEYSRYFMG

LBRWZZJGQ

VNWJSZFCD

WEDCLBQHY

QUTCVMJTD

FUGFHOFMG

NVCOUUVBE

HBXNMWAQX

WOXGFMCZS

BJIRKXGKQ

RZQJLSPZA

FTCBCWNNX

BTFONCJAH

JXMXQZMCI

VWFGMIORY

MVNPXQKJM

YCEPYOXNG

SGVODKLIS

JOUPFGGNO

TJSRQVYPG

OMPEDREMB

YWIXGDBYP

DAJBAXYOZ

VNFOXEYSJ

ZIQJIPMGK

IHQKZWDNY

CRGTBYFYY

JRUJCSWQX

YWFODAHRC

YNFVEKBYI

KYRKSHOYZ

SATSHEBAU

YWWPMTZCF

YMPOHOULC

WKWPYFWMN

BJIIAOUVF

OCBATKAGK

LGYPYMDJK

KYRANRFMG

MUNWFCGGA

LKJIKLRCC

BJFHAHKUV

HEONZFYUK

ULXCRAJMQ

NHFQZLIER

IJOQOCLVL

BIKMRUVVL

VMRDQJMSP

KSAYKALOR

HCFUDDAGW

LCXCLOKKA

MUMBXDGJJ

VWONYBLHN

MJBTKHQZT

QRHTHOEMF

GWUCRKKHD

WKWUMWLCL

GRTBDMGUK

YFUWOKNJZ

WLAHKBYOZ

JGYAJSILR

QOPYWPPCM

YZEGOIBPV

YAGRXGZMM

MTLDFPFYE

UIUJUEKUN

LZRSOOHWF

LKSSROFCW

KILUMZRVP

MEJCMTQHY

ECWVOVPGW

NUWZUFMMW

CQPYXEROV

UCEDJAABL

YXFIBZWRL

RWFYIZZTA

WHGLEVBCC

ZXGFICZFQ

GETSIYSJT

NBBTEBLTN

AYRQZMZGA

CKTYREBBS

SGPSOVVGO

OMCDFCTGA

LAZSLIIZP

MATDCQWXH

RPSHQUBLL

BNCBDXYVV

ZXQZPWJLI

LGCVEUROP

RMQNMTTQH

VBUJJTJNR

IGAZRSPZZ

ODMIIZZAA

UJVEXVSDT

NFKTCJJSM

LAZCBBFLW

PXDLLLOFZ

JOQPBFMMQ

YDYLNALRC

LJYHKKXBS

GLKTVSJQO

BZBKAKXXG

DBACCWTTI

OVHPXQGDN

SJRTILOUA

CCBJFONZC

GEXQITJKA

IVEMMCRLC

EJYHQGPWW

AFYDWNTEM

DRRYARRLV

CAGFOXQXB

OSBKTSYZQ

NBUWWTQZP

LAZIQOJZG

BWIQPMJWB

BTCBEBIPZ

UPHAAXUHR

ASBGZMZQG

OMVXQROEV

IUEWWSJKE

CQQIYIFNE

LZBKDCZWA

HVMFOOFFW

WFOIIOPMM

INWHPMXNR

CKJMBRPVW

ZNWILIKEG

WOATCJNNY

VDVONHGXH

MYHIBBCCM

OJLUDCCMN

UYBKTAXUE

UMRATRPFG

UOXGHOGGR

JRKZYPZQK

FHGVOREFM

UTLETHFWA

AIOQPQGNO

BNDMEVLCG

WETSJQXXR

RIHGXXAXN

VDYSQTGJJ

STIUSVLIL

LMEMIEMMS

PAVTPYLXN

FZENIOLBH

IZRJHXREX

VZFHFIBYL

ZFDVRNGJW

AEGHWLREA

XIDPXQQWE

DOJLTNJWQ

DFXWROHHX

YGOGFSBBZ

RCKGYUHQA

PQFIAANTJ

FMBNCFFBO

KNIUPMFSE

BCRJDFMPL

DXWONJDPU

OYDFEHADN

EFXPUXAAD

KYGBUPVIB

JXINPIVFE

查看完整回答
反对 回复 2021-10-19
  • 1 回答
  • 0 关注
  • 1083 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信