Form the Cubic equation from the given roots | C ++ program for the approach ; Function to find the cubic equation whose roots are a , b and c ; Find the value of coefficient ; Print the equation as per the above coefficients ; Driver Code ; Function Call
#include <bits/stdc++.h> NEW_LINE using namespace std ; void findEquation ( int a , int b , int c ) { int X = ( a + b + c ) ; int Y = ( a * b ) + ( b * c ) + ( c * a ) ; int Z = a * b * c ; cout << " x ^ 3 ▁ - ▁ " << X << " x ^ 2 ▁ + ▁ " << Y << " x ▁ - ▁ " << Z << " ▁ = ▁ 0" ; } int main ( ) { int a = 5 , b = 2 , c = 3 ; findEquation ( a , b , c ) ; return 0 ; }