53.2k views
1 vote
Write a statement that computes the square root of a variable called discriminant

and stores the value in a variable called result.

User Vafylec
by
8.1k points

1 Answer

4 votes

Answer:

// here is statement in C++ to compute square root of a variable.

double result=sqrt(discriminant);

Step-by-step explanation:

Sqrt() method will compute the square root of a variable in C++.Read a value of discriminant and find the square root of it and assign it to variable "result".

Implementation in C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

// variables

double discriminant;

// ask to enter discriminant

cout<<"Enter the discriminant:";

// read discriminant

cin>>discriminant;

double result=sqrt(discriminant);

cout<<"Square root of discriminant is:"<<result<<endl;

return 0;

}

Output:

Enter the discriminant:50

Square root of discriminant is:7.07107

User Argus Malware
by
8.4k points