nikolas_serafini

Lista 1 - Exercício 42

May 24th, 2013
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. int main()
  6. {
  7.     float x1,x2,a,b,c;
  8.  
  9.     printf("Entre com os coeficientes de uma equacao de segundo grau : \n"); scanf("%f %f %f",&a,&b,&c);
  10.  
  11.     x1 = (-b + sqrt(pow(b,2) - 4*a*c)) / (2*a);
  12.     x2 = (-b - sqrt(pow(b,2) - 4*a*c)) / (2*a);
  13.  
  14.     printf("Primeira raiz = %f\nSegunda raiz = %f",x1,x2);
  15.     return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment