daily pastebin goal
31%
SHARE
TWEET

Second degré

a guest Sep 14th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from math import *
  2.  
  3. print('Ce programme va résoudre l\'équation ax²+bx+c=0.')
  4. print('Veuillez entrer les valeurs des coefficients a, b et c.')
  5. a=float(input('Quelle est la valeur de a ? '))
  6. b=float(input('Quelle est la valeur de b ? '))
  7. c=float(input('Quelle est la valeur de c ? '))
  8.  
  9. Delta=b**2-4*a*c
  10.  
  11. print('Le discriminant de l\'équation est :',Delta)
  12.  
  13. if Delta<0:
  14.     print('L\'équation n\'a pas de solution.')
  15. else:
  16.     x1=(-b-sqrt(Delta))/(2*a)
  17.     x2=(-b+sqrt(Delta))/(2*a)
  18.     print ('Les solutions sont {} et {}.'.format(x1,x2))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top