Communities

IMECC
IMECC
MA111
MA211
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Procurar help
Notifications
Mark all as read See all your notifications »
Q&A

Comments on Exemplo de programa

Post

Exemplo de programa

+1
−0

Exemplo de programa:

# Solve the quadratic equation ax**2 + bx + c = 0

# import complex math module
import cmath

a = 1
b = 5
c = 6

# calculate the discriminant
d = (b**2) - (4*a*c)

# find two solutions
sol1 = (-b-cmath.sqrt(d))/(2*a)
sol2 = (-b+cmath.sqrt(d))/(2*a)

print('The solution are {0} and {1}'.format(sol1,sol2))

Outros exemplos podem ser encontrados na Internet.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

No caso de $d=0$, o código podia mostrar só uma das soluções. (1 comment)
No caso de $d=0$, o código podia mostrar só uma das soluções.

No caso de $d=0$, o código podia mostrar só uma das soluções.