给出一个算法: Read x If &nbs
来源:学生作业帮 编辑:搜搜做题作业网作业帮 分类:数学作业 时间:2024/07/19 09:47:57
给出一个算法:
Read x
If x≤0,Then
f(x)←4x
Else
f(x)←2x
End,If
Print,f(x)
根据以上算法,可求得f(-1)+f(2)=______.
Read x
If x≤0,Then
f(x)←4x
Else
f(x)←2x
End,If
Print,f(x)
根据以上算法,可求得f(-1)+f(2)=______.
![给出一个算法: Read x If &nbs](/uploads/image/z/8877708-36-8.jpg?t=%E7%BB%99%E5%87%BA%E4%B8%80%E4%B8%AA%E7%AE%97%E6%B3%95%EF%BC%9A%26nbsp%3BRead%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3Bx%26nbsp%3BIf%26nbsp%3B%26nbs)
根据算法程序得:f(x)=
4x x≤0
2x x>0
∴f(-1)+f(2)=4×(-1)+4=0.
故答案为:0
4x x≤0
2x x>0
∴f(-1)+f(2)=4×(-1)+4=0.
故答案为:0