Tuesday, 31 July 2018

Forming Quadratic equation

===========================================================================
                                CODING



#include<iostream.h>
#include<conio.h>

void main()
{
    clrscr();
    int x1,x2,sum,prod;
    cout<<"\nFormng of equation from Roots:- \n Enter first Root of the equation: ";
    cin>>x1;
    cout<<"\n Enter second Root of the equation: ";
    cin>>x2;
    sum=x1+x2;
    prod=x1*x2;
    if(sum>=0)
    {   if(prod>=0)
cout<<"\n\nThe equation is: xý-"<<sum<<"x+"<<prod;
else
cout<<"\n\nThe equation is: xý-"<<sum<<"x"<<prod;
    }
    else
    {   if(prod>=0)
cout<<"\n\nThe equation is: xý"<<sum<<"x+"<<prod;
else
cout<<"\n\nThe equation is: xý"<<sum<<"x"<<prod;
    }
    getch();
}



===========================================================================


                                OUTPUT


No comments:

Post a Comment