C++ Code To Determine Discriminant Of A Quadratic Equation

Thursday, 15 December 2016

Statement : Write the C++ code for computing the result for b^2 -4ac.
Code :
#include<iostream>
using namespace std;
int main()
{
       int a, b, c, disc;

       cout << "\t\t\tCalculate Discriminent\n\n";
       cout << "Enter The Value Of x^2 Coefficient : ";
       cin >> a;
       cout << "Enter The Value Of x Coefficient : ";
       cin >> b;
       cout << "Enter The Value Of Constant : ";
       cin >> c;
       disc = (b*b) - 4*(a*c);
       cout <<"The Value of Disc is :"<< disc;

    cout << "\n\n";
       system("pause");
return 0;
}

Mohammad Tayyab

Author & Editor

Imagination is more important than knowledge.

0 comments:

Post a Comment