Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- double a, b, c;
- float xp, xn, z;
- int main()
- {
- printf(" Leandro Soares");
- printf("\n a? : "); // inserir o a
- scanf("%lf", &a);
- printf(" b? : "); // inserir o b
- scanf("%lf", &b);
- printf(" c? : "); // inserir o c
- scanf("%lf", &c);
- z = pow(b, 2) - 4 * a * c;
- if(z < 0)
- {
- printf("\n\n Raizes nao reais \n\n");
- return 0;
- }
- xp = ( -b + sqrt( z ) ) / 2 * a;
- xn = ( -b - sqrt( z ) ) / 2 * a;
- printf(" x = %f e %f\n\n", xp, xn); // output x positivo e x negativo
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement