Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <iostream>
- #include <conio.h>
- #include <math.h>
- #include <locale.h>
- main ()
- {
- int a,b,c;
- float x1,x2;
- printf ("Digite o coeficiente a = ");
- scanf ("%d", &a);
- printf ("Digite o coeficiente b = ");
- scanf ("%d", &b);
- printf ("Digite o coeficiente c = ");
- scanf ("%d", &c);
- if ((pow(b, 2)-4*a*c) < 0 ){
- printf ("Não há raízes reais");}
- else {
- x1 = (-b+(sqrt(pow(b, 2)-(4*a*c)))) / 2*a;
- x2 = (-b-(sqrt(pow(b, 2)-(4*a*c)))) / 2*a;
- printf ("As raizes da equacao sao = %f e %f", x1, x2);
- }
- getch ();
- }
Add Comment
Please, Sign In to add comment