ramontricolor12

LISTA 02 - exercicio 60

May 27th, 2013
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. int main()
  4. {
  5.     float a, b, c, delta, raizPos, raizNeg;
  6.  
  7.     printf("\nInforme os 3 coeficientes da equacao: ");
  8.     scanf("%f %f %f", &a, &b, &c);
  9.  
  10.     //Processamento
  11.     delta = pow(b,2.0) - (4.0*a*c);
  12.     if(delta > 0)
  13.     {
  14.         raizPos = (-b + sqrt(delta)) / (2.0*a);
  15.         raizNeg = (-b - sqrt(delta)) / (2.0*a);
  16.         printf("\nRaiz 1 : %f \n Raiz 2 : %f \n", raizPos, raizNeg);
  17.     }
  18.     else
  19.         printf("\nSem raizes reais.\n");
  20.  
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment