Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- void solve(double a, double b, double c);
- void imprimir(double im);
- int main()
- {
- double a,b,c;
- scanf("%lf %lf %lf",&a,&b,&c);
- solve(a,b,c);
- printf("TERMINADO\n");
- }
- void solve(double a, double b, double c){
- double ans=-b/(a*2); //-b/2a
- double s=(sqrt(b*b-4*a*c)/(a*2)); //sqrt(b^2-4ac)/(2a)
- ans+=s;
- imprimir(ans);
- printf("y ");
- ans-=2*s;
- imprimir(ans);
- }
- void imprimir(double im){
- printf("Resultado: %.3f, ", im);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement