Program to find number of solutions in Quadratic Equation | C ++ Program to find the solutions of specified equations ; Method to check for solutions of equations ; If the expression is greater than 0 , then 2 solutions ; If the expression is equal 0 , then 2 solutions ; Else no solutions ; Driver Code
#include <iostream> NEW_LINE using namespace std ; void checkSolution ( int a , int b , int c ) { if ( ( ( b * b ) - ( 4 * a * c ) ) > 0 ) cout << "2 ▁ solutions " ; else if ( ( ( b * b ) - ( 4 * a * c ) ) == 0 ) cout << "1 ▁ solution " ; else cout << " No ▁ solutions " ; } int main ( ) { int a = 2 , b = 5 , c = 2 ; checkSolution ( a , b , c ) ; return 0 ; }