课程11 项目四

任务和代码

/*
*Copyright ©2017,CSDN学院
*All rights reserved.
*文件名称:main.c
*作    者:LP
*完成日期:2017年10月11日
*版 本 号:visual studio 2015
*问题描述:输入3个双精度实数,分别求出它们的和、平均值、平方和以及平方和的开方,并输出所求出各个值。
*/

#include<stdio.h>
#include<math.h>
int main()
{
	double a, b, c, sum, ave, sum_square, prescibe;
	printf("Enter three double numbers:");
	scanf("%lf %lf %lf", &a, &b, &c);
	sum = a + b + c;
	ave = sum / 3.0;
	sum_square = pow(a, 2) + pow(b, 2) + pow(c, 2);
	prescibe = sqrt(sum_square);
	printf("sum=%lf ave=%lf sum_square=%lf prescibe=%f", sum, ave, sum_square, prescibe);
	return 0;
}

运行结果


心得

这里面用到了math头文件,math.h头文件里面包含了很多数学的运算指令

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值