全文预览

C语言实验题及参考答案

上传者:幸福人生 |  格式:pdf  |  页数:89 |  大小:5262KB

文档介绍
\r'()*+,-SˆŒ{? ¡ 23\n,¢£a¤\n*1!+2!+3!+...+n! ŽP\ršL›œžp\rdoublefact(intn);\rdoublefactsum(intn);\rfact?\r  ¡¥¦a—˜+,P\nfactsum?\r1!+2!+W+”¨ ŽP(‘i7i<Nš›œ”•eP\rŸ ¡¢RHP`p\r#include<stdio.h>\rdoublefact(intn);\rdoublefactsum(intn);\rintmain()\r(\rintn;\rscanf("%d",&n);EvaluationWarning:ThedocumentwascreatedwithSpire.PDFfor.NET.\rprintfC'fact(%d)=%.0f\n",n,fact(n));\rprintf("sum-%.0f\n",factsum(n));\rreturn0;\r)\r/ª¥E¦§S«©z{|*/\r0@P`1:\r10\r0?P`1:\rfact(10)=3628800\rsum=4037913\r0@P`2p\r0\r0?P`2p\rfact(0)=1\rsum-0\r?\rdoublefact(intn)\r(\rinti;\rdoublem=1;\rif(n==0)\rreturnm;\relse\rfor(i=l;i<=n;i++)EvaluationWarning:ThedocumentwascreatedwithSpire.PDFfor.NET.\rm=m*i;\rreturnm;\r)\rdoublefactsum(intn)\r(\rintj;\rdoublesum;\rsum=0;\rif(n>0)\r(\rfor(j=l;j<=n;j++)\rsum+=fact(j);\r)\rreturnsum;

收藏

分享

举报
下载此文档