Created
February 26, 2017 18:00
-
-
Save sazid/b9f94b56674c69682df7f7bad8ad7165 to your computer and use it in GitHub Desktop.
This file contains hidden or 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() | |
{ | |
int a, b, c; | |
double root_1, root_2; | |
printf("For ax^2 + bx + c = 0 ; give the following inputs.\n"); | |
printf("Input a: "); | |
scanf("%d", &a); | |
printf("Input b: "); | |
scanf("%d", &b); | |
printf("Input c: "); | |
scanf("%d", &c); | |
root_1 = (-b + sqrt(b*b - 4 * a *c)) / 2 * a; | |
root_2 = (-b - sqrt(b*b - 4 * a * c)) / 2 * a; | |
printf("The two roots are: %.02f and %.02f\n", root_1, root_2); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment