中国大学c语言程序题.pdf

第 3 周编程题在线测试 1 计算两个数的平方和( 3 分) 题目内容: 从键盘读入两个实数,编程计算并输出它们的平方和,要求使用数学函数 pow(x,y) 计算平方 值,输出结果保留 2 位小数。程序中所有浮点数的数据类型均为 float 。 提示:使用数学函数需要在程序中加入编译预处理命令 #include math.h 以下为程序的运行结果示例: please input x and y: 1.2,3.4↙ Result=13.00 输入格式 : %f,%f 输出格式: 输入提示信息: Please input x and y:\n 输出格式: Result=%.2f\n 为避免出现格式错误,请直接拷贝粘贴题目中给的格式字符串和提示信息到你的程序中。 #include stdio.h #include math.h int main() { float x,y; printf(Please input x and y:\n); scanf(%f

文档评论(0)

1亿VIP精品文档

相关文档