victorialais

Untitled

Aug 9th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <iostream>
  3. #include <conio.h>
  4. #include <math.h>
  5. #include <locale.h>
  6.  
  7. main ()
  8.  
  9. {
  10. int a,b,c;
  11. float x1,x2;
  12. printf ("Digite o coeficiente a = ");
  13. scanf ("%d", &a);
  14. printf ("Digite o coeficiente b = ");
  15. scanf ("%d", &b);
  16. printf ("Digite o coeficiente c = ");
  17. scanf ("%d", &c);
  18. if ((pow(b, 2)-4*a*c) < 0 ){
  19. printf ("Não há raízes reais");}
  20. else {
  21.  
  22. x1 = (-b+(sqrt(pow(b, 2)-(4*a*c)))) / 2*a;
  23. x2 = (-b-(sqrt(pow(b, 2)-(4*a*c)))) / 2*a;
  24. printf ("As raizes da equacao sao = %f e %f", x1, x2);
  25. }
  26. getch ();
  27.  
  28. }
Add Comment
Please, Sign In to add comment