求算术平均数和集合平均数的源代码 新手请收藏

发布时间:   来源:CSDN  

求算术平均数和集合平均数的源代码


(相关资料图)

我是新手

请大家看看什么地方需要改进!

算发有什么问题?

谢谢

我忘了加注释!

/* Note:Your choice is C IDE */

/* 当前版本1.1

作者:韩耿

完成日期 200

取代版本1.0

作者:韩耿

完成日期 2007.7.30

新增功能: 1判断整负数

2修改显示功能

程序描述:计算两个数的算术平均数和几何平均数

*/

#include "stdio.h"

#include "math.h"

main()

{

float a=0,b=0,c=0,d=0,e=0;

printf("This programmer is used by Hangeng only!\n");

printf(" Please enter numbet a!\n");

scanf("%f",&a);

printf("a=%f\n",a);

printf("Please enter numbet b!\n");

scanf("%f",&b);

printf("b=%f\n\n",b);

e=a*b;

if ((a*b)>=0)

{

c=(a+b)/2;

d=sqrt(a*b);

printf(" We are thinking!\n");

printf("ok!");

printf("a=%f\n",a);

printf("b=%f\n",b);

printf("The arithmetic mean is %f\n",c);

printf("The geometric mean is %f\n",d);

}

else

{

printf("a*b=%f<0\nSo the numbei is wrong!\n",e);

}

printf("Plesae push enter to go out!");

getch();

}

/* 版权所有 翻录不究*/

这是生成的程序

aWAhfecI.rar

(17.84 KB)

求算术平均数和集合平均数的源代码

相关文章Related

返回栏目>>