Ecuaciones de segundo grado completas


/ Published in: C#
Save to your folder(s)

Un programa en español que calcula la fórmula de las ecuaciones de segundo grado.


Copy this code and paste it in your HTML
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main(void)
  5. {
  6. int a;
  7. int b;
  8. int c;
  9.  
  10. double r;
  11.  
  12. printf("Introduzca el valor de a: ");
  13. fflush(stdout);
  14. scanf("%d", &a);
  15.  
  16. printf("Introduzca el valor de b: ");
  17. fflush(stdout);
  18. scanf("%d", &b);
  19.  
  20. printf("Introduzca el valor de c: ");
  21. fflush(stdout);
  22. scanf("%d", &c);
  23.  
  24. r = (-b + sqrt(b*b - 4*a*c))/(2*a);
  25. printf("%f", r);
  26.  
  27. return 0;
  28. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.