C Program To Find Quadratic Equation
Next: Write a C# Sharp program to read roll no, name and marks of three subjects. Within this program to find roots of quadratic equation example, User entered Values are 10 15 -25. It means a = 10, b = 15, c = -25 and the Quadratic equation is 10x²+15x-25 = 0. Program to find roots of a quadratic equation. Here we will discuss how to find the roots of a quadratic equation using the C programming language. An equation is said to be a quadratic equation if it’s in the form, ax2+bx+c = 0 (where a!= 0). To find the roots of any quadratic equation first we need to find the Discriminant(D) and the.
C program to find roots of a quadratic equation: Coefficients are assumed to be integers, but roots may or may not be real.
C Program To Find Roots Of Quadratic Equation Using Functions
For a quadratic equation ax2+ bx + c = 0 (a≠0), discriminant (b2-4ac) decides the nature of roots. If it's less than zero, the roots are imaginary, or if it's greater than zero, roots are real. If it's zero, the roots are equal.
For a quadratic equation sum of its roots = -b/a and product of its roots = c/a. Let's write the program now.
Program to find roots of quadratic equations in c computer science engineer status/software Engineerprinting our name in c/computer science engineering statu. C Program to find the roots of quadratic equation. Quadratic equations are the polynomial equation with degree 2. It is represented as ax 2 + bx +c = 0, where a, b and c are the coefficient variable of the equation. The universal rule of quadratic equation defines that the value of 'a' cannot be zero, and the value of x is used to find the.
Roots of a Quadratic equation in C
#include <stdio.h>#include <math.h>
int main()
{
int a, b, c, d;
double root1, root2;
C Program To Find Quadratic Formula
printf('Enter a, b and c where a*x*x + b*x + c = 0n');
scanf('%d%d%d',&a,&b,&c);
d = b*b -4*a*c;
if(d <0){// complex roots, i is for iota (√-1, square root of -1)
printf('First root = %.2lf + i%.2lfn',-b/(double)(2*a),sqrt(-d)/(2*a));
printf('Second root = %.2lf - i%.2lfn',-b/(double)(2*a),sqrt(-d)/(2*a));
}
else{// real roots
root1 =(-b +sqrt(d))/(2*a);
root2 =(-b -sqrt(d))/(2*a);
printf('First root = %.2lfn', root1);
printf('Second root = %.2lfn', root2);
}
C Program To Find Roots Of Quadratic Equation Using Pointers
return0;
}