im trying to make a c program that executes the quadratic formula but im having troubles finishing it.
#include<math.h>
#include<stdio.h>
int main()
{
double a,b,c,total_1,total_2,total_3,total_4,total_5;
printf("Enter 'a' value> ");
scanf("%lf",&a);
printf("Enter 'b' value> ");
scanf("%lf",&b);
printf("Enter 'c' value> ");
scanf("%lf",&c);
total_1=(-b);
total_2=(b*b)-(4*a*c);
total_3=(2*a);
if (total_2<0)
{
printf("Does not exist\n");
}
else (total_4=(total_1 + (sqrt(total_2))/total_3), total_5=(total_1
- (sqrt(total_2))/total_3)
{
printf("The two roots of the equation are
%lf,%lf",&total_4,&total_5);
}
}
#include<math.h> #include<stdio.h> int main() { double a,b,c,total_1,total_2,total_3,total_4,total_5; printf("Enter 'a' value> "); scanf("%lf",&a); printf("Enter 'b' value> "); scanf("%lf",&b); printf("Enter 'c' value> "); scanf("%lf",&c); total_1=(-b); total_2=(b*b)-(4*a*c); total_3=(2*a); if (total_2<0) { printf("Does not exist\n"); } else { total_4=((total_1 + sqrt(total_2))/total_3); total_5=((total_1 - sqrt(total_2))/total_3); printf("The two roots of the equation are %lf,%lf",total_4,total_5); } }
Get Answers For Free
Most questions answered within 1 hours.