题目详情
单选题
根据上面公式计算并输出x的值,a和b的值由用户输入,括号里的数字是角度值, 要求圆周率的值使用数学常数math.pi,三角函数的值用math库中对应的函数进行计算 . 正确的程序代码为
A. import math a = float(input()) b = float(input()) x = (-b+math.sqrt(2 * a * math.sin(60)*math.cos(60)))/(2 * a) print(x)
B. import math a = input() b = input() x = (-b+math.sqrt(2 * a * math.sin(60)*math.cos(60)))/(2 * a) print(x)
C. import math a = float(input()) b = float(input()) x = (-b+math.sqrt(2 * a * math.sin(pi / 3)*math.cos(pi / 3)))/(2 * a) print(x)
D. import math a = float(input()) b = float(input()) x = (-b+math.sqrt(2 * a * math.sin(math.pi / 3)*math.cos(math.pi / 3)))/(2 * a) print(x)

学科:Python程序设计基础
时间:2024-07-08 09:22:48
相关题目
相关作业
