任务和代码
/*
*copyright(c)2017,CSDN学院
*All rights reserved.
*文件名称: main.c
*作 者: 杨隆胜
*完成日期: 2017年5月16日
*版 本 号: v1.0
*
*问题描述:输入3个双精度实数,分别求出它们的和、平均值、平方和以及平方和的开方,并输出所求出各个值。
*输入描述:输入3个双精度实数;
*程序输出:输出它们的和、平均值、平方和以及平方和的开方,并输出所求出各个值;
*/
#include <stdio.h>
#include <math.h>
int main()
{
double d1,d2,d3,sum,average,square,SQRT;
printf("Please input three double:\n");
scanf("%lf %lf %lf",&d1,&d2,&d3);
sum=d1+d2+d3;
average=sum/3;
square=d1*d1+d2*d2+d3*d3;
SQRT=sqrt(square);
printf("The sum of three number is:%lf\n",sum);
printf("The average of three number is:%lf\n",average);
printf("The square of three number is:%lf\n",square);
printf("The SQRT of three number is:%lf\n",SQRT);
return 0;
}
运行结果
知识点总结
开根号运算符sqrt,因为在标准函数库中,因此要调用sqrt需要在开头加入#include <math.h>,才能够调用。
心得体会
感觉自己学习进度挺慢的,希望自己在接下来的日子里加油吧,不然梦想不等人啊。