C语言求概率问题#includemain(){\x05int a[10],i,j,temp,gs,yx;\x05double z;\x05char n,w;\x05printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");\x05printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/29 03:31:47
C语言求概率问题#includemain(){\x05inta[10],i,j,temp,gs,yx;\x05doublez;\x05charn,w;\x05printf("+++++++++++++

C语言求概率问题#includemain(){\x05int a[10],i,j,temp,gs,yx;\x05double z;\x05char n,w;\x05printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");\x05printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C语言求概率问题
#include
main()
{
\x05int a[10],i,j,temp,gs,yx;
\x05double z;
\x05char n,w;
\x05printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
\x05printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
\x05printf("++ ——————————————————————————— ++\n");
printf("++ | | ++\n");
\x05printf("++ | 学生成绩统计盒子 | ++\n");
\x05printf("++ ——————————————————————————— ++\n");
\x05printf("++ ______________________________________________________ ++\n");
\x05printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
\x05printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
\x05w='y';
\x05while(w=='y'||w=='Y')
\x05{
\x05yx=0;\x05
\x05printf("\n请输入所统计的成绩个数(最多10个).\n(输入完后按回车继续)\n");
\x05scanf("%d",&gs);
\x05if(gs>10)
\x05\x05{
\x05\x05printf("\n错误!\n");
continue;
\x05}
\x05else
\x05printf("\n请依次输成绩分数(并用回车分开)\n(输入完后按回车继续)\n");
\x05\x05for(i=0;i90)
\x05\x05\x05{
\x05\x05\x05\x05yx=yx+1;
\x05\x05\x05}
\x05}
\x05for(j=0;j

C语言求概率问题#includemain(){\x05int a[10],i,j,temp,gs,yx;\x05double z;\x05char n,w;\x05printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");\x05printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
z=(yx/gs)*100;
改为
z=((float)yx/gs)*100;
如:
1/2=0
但是1.0/2=0.5