Professional Documents
Culture Documents
CSC415
#include<iostream>
using namespace std;
main ()
{
int no1, no2, no3;
system ("pause");
return 0;
}
Question 2
#include <iostream>
#include <cmath>
using namespace std;
main ()
{
float a,b,c,x1,x2, discriminant;
else if(a==0)
{
cout<<" The function have one root "<<endl;
x1=x2= (-c/b);
cout<<" The root is equal to " << x1 <<endl;
}
else if(discriminant>0)
{
x1 = (-b + sqrt(discriminant)) / (2*a);
x2 = (-b - sqrt(discriminant)) / (2*a);
cout << " The funtion have two different roots. " <<endl;
cout << " x1= " << x1 <<endl;
cout << " x2= " << x2 <<endl;
else if(discriminant<0)
{
cout << "The funtion have no real root " <<endl;
return 0;