Created
September 1, 2017 16:25
-
-
Save brun0xff/0cd044752e4297716fa8b03e3e866f80 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <math.h> | |
using namespace std; | |
int main(int argc, char const *argv[]) | |
{ | |
double a, b, c, delta, raizdelta, r1, r2; | |
scanf("%lf", &a); | |
scanf("%lf", &b); | |
scanf("%lf", &c); | |
delta = (b * b) - (4 * a * c); | |
if(delta >= 0 && a != 0){ | |
raizdelta = sqrt(delta); | |
r1 = ((-b) + raizdelta) / (2 * a); | |
r2 = ((-b) - raizdelta) / (2 * a); | |
printf("R1 = %.5f\nR2 = %.5f\n", r1, r2); | |
return 0; | |
} | |
else{ | |
printf("Impossivel calcular\n"); | |
return 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment