-
-
Save programmingfaster0226/18a2f31423a435ae9d4744f161bf6364 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
/*program to read the values for coefficients a,b and c of a quadratic equation ax²+bx+c=0*/ | |
#include<stdio.h> | |
#include<conio.h> | |
#include<math.h> | |
void main() | |
{ | |
int a,b,c,d; | |
float r1,r2; | |
printf("enter a ,b,c:"); | |
scanf("%d%d%d",&a,&b,&c); | |
d=(b*b)-(4*a*c);\ | |
if (d>0) | |
{ | |
r1=(-b + sqrt(d))/(2*a); | |
printf("answer=%f",r1); | |
r2=(-b - sqrt(d))/(2*a); | |
printf("answer=%f",r2); | |
} | |
else | |
printf("the root is imaginary:"); | |
getch(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment