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

Post History

60%
+1 −0
Q&A Exemplo de programa

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) ...

1 answer  ·  posted 11d ago by Rodolfo Broco Manin‭  ·  last activity 11d ago by Paulo Henrique de Oliveira‭

Question geral
#1: Initial revision by user avatar Rodolfo Broco Manin‭ · 2024-10-10T17:02:49-03:00 (11 days ago)
Exemplo de programa
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.