Skip to content

Instantly share code, notes, and snippets.

@programmingfaster0226

programmingfaster0226/test Secret

Created Jan 18, 2018
Embed
What would you like to do?
/*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
You can’t perform that action at this time.