-->
当前位置:首页 > 题库

PROGRAMMING:solve equations

Luz5年前 (2021-05-10)题库449
Solve the quadratic equation AX2 + BX + C = 0. Input the values of a, B and C (a, B and C are all integers and a ≠ 0), calculate and output the solution X of the equation (with 3 decimal places reserved). If the equation has no real solution, output "no real solution".
###Input format:
Enter the values of a, B, C (a, B, C are all integers, and a ≠ 0)
###Output format:
Output the solution of the equation. If there is a real solution, keep 3 decimal places. The output format refers to the example. If the equation has no real solution, output "no real solution".
###Input sample 1:
```in
1 4 3
```
###Output sample 1:
```out
x1=-3.000
x2=-1.000
```
###Input sample 2:
```in
1 -2 1
```
###Output sample 2:
```out
x=1.000
```
###Input sample 3:
```in
1 -2 4
```
###Output sample 3:
```out
no real solution
```







answer:If there is no answer, please comment