Write a program in c that follows the steps described in que

Write a program in c++ that follows the steps described in questions 1, 2, 3 and 4.

1. The program ask the user to enter 3 integer variables (a,b and c) and 3 decimal variables (x1, x2, and delta) after declaration of these variables.

2. Make the program display the following equation for each a b, and c as follows: ax^2 + bx + c = 0

3. Please make the program compute the discriminant delta: delta=b^2-4ac

4. Discuss the cumber of solutions to the equation in question 2.

Solution

#include<iostream>
using namespace std;


int main()
{
cout<<\"Enter 3 integer variables(a,b and c):\"<<endl;
int a,b,c;
cin>>a;
cin>>b;
cin>>c;
cout<< a << \"x^2 + \" << b << \"x + \"<< c <<\" = 0\"<<endl;
  
float delta = b*b - 4*a*c;
if(delta < 0)
cout<<\"Equation has no solution\";
else if(delta > 0)
cout<<\"Equation has 2 distinct solution\";
else
cout<<\"Equation has 1 solution\";
return 0;
}

Write a program in c++ that follows the steps described in questions 1, 2, 3 and 4. 1. The program ask the user to enter 3 integer variables (a,b and c) and 3 d

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site