Write a program in C to find the roots of a quadratic equation after checking its nature of roots. Use if…else condition to check nature of roots. code example
Example: Program to find number of solutions in Quadratic Equation c#
static void checkSolution(int a, int b, int c)
{
// If the expression is greater than 0,
// then 2 solutions
if (((b * b) - (4 * a * c)) > 0)
System.out.println("2 solutions");
// If the expression is equal 0, then 2 solutions
else if (((b * b) - (4 * a * c)) == 0)
System.out.println("1 solution");
// Else no solutions
else
System.out.println("No solutions");
}