Skip to content

Instantly share code, notes, and snippets.

@LeonardoPizzoquero
Last active February 20, 2019 13:52
Show Gist options
  • Save LeonardoPizzoquero/801b29c22c48c617e6a4e2aa3123592d to your computer and use it in GitHub Desktop.
Save LeonardoPizzoquero/801b29c22c48c617e6a4e2aa3123592d to your computer and use it in GitHub Desktop.
HonestTightAggregators created by LeonardoPizzoqu - https://repl.it/@LeonardoPizzoqu/HonestTightAggregators
#include <stdio.h>
#include <math.h>
int main(void) {
float a,b,c,delta;
printf("Digite o valor de a: \n");
scanf("%f", &a);
printf("Digite o valor de b: \n");
scanf("%f", &b);
printf("Digite o valor de c: \n");
scanf("%f", &c);
delta = (pow(b, 2)) - 4 * a * c;
if(delta > 0){
printf("X1 = %.2f\n", (-b + sqrt(delta)) / (2 * a));
printf("X2 = %.2f\n", (-b - sqrt(delta)) / (2 * a));
} else if(delta == 0){
printf("Única raiz = %.2f\n", (-b + sqrt(delta)) / (2 * a));
} else {
printf("Não há raízes reais");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment