-
-
Save MitchellScottHenke/112b5f35fff56e1f77fd 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 <stdio.h> | |
#include <math.h> | |
int main() | |
{ | |
float a, b, c; | |
float pos, neg; | |
printf("Working on a Quadratic formula? Let me help!\nA="); | |
scanf("%f",&a); | |
printf("B="); | |
scanf("%f",&b); | |
printf("C="); | |
scanf("%f",&c); | |
printf("A=%f\nB=%f\nC=%f\n",a,b,c); | |
pos = ((-b + sqrt(pow(b,2)-(4*a*c)))/(2*a)); | |
neg = ((-b - sqrt(pow(b,2)-(4*a*c)))/(2*a)); | |
if (( pow (b, 2) - (4*a*c))<=0) printf("You have a non-real answer on your hand$ | |
else printf("%f,%f\n",pos,neg); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment