![Computers and Technology](/tpl/images/cats/informatica.png)
Computers and Technology, 03.03.2020 05:57, lillieannereed
Write a program to solve a quadratic equation. The program should allow the user to enter the values for a, b, and c. If the discriminant is less than zero, a message should be displayed that the roots are imaginary; otherwise, the program should then proceed to calculate and display the two roots of the eqaution. (Note: Be certain to make use of the squareRoot () function that you developed in this chapter.) (In C language)
Hint: This should not be too hard. You need to get some numbers from the user, do some calculations, check if the discriminate is negative, then use the textbook author’s squareRoot function to finish up the calculations!
program 7.8:
// Function to calculate the absolute value of a number
#include
float absoluteValue(float x)
{
if (x < 0)
x = -x;
return (x);
}
// Function to compute the square root of a number
float squareRoot(float x)
{
const float espsilon = .00001;
float guess = 1.0;
while (absoluteValue(guess * guess - x) >= espsilon)
guess = (x / guess + guess) / 2.0;
return guess;
}
int main(void)
{
printf("squareRoot (2.0) = %f\n", squareRoot(2.0));
printf("squareRoot (144.0) = %f\n", squareRoot(144.0));
printf("SquareRoot (17.5) = %f\n", squareRoot(17.5));
return 0;
}
![answer](/tpl/images/cats/otvet.png)
Answers: 2
Other questions on the subject: Computers and Technology
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 21.06.2019 17:20, gracie0818
Q-3 a technician is setting up a computer lab. computers on the same subnet need to communicate with eachother peer to peer communication, a. hardware firewallb. proxy serverc. software firewalld. gre tunneling
Answers: 3
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 20:00, manyah6189
Amanda needs to create an informative print brochure for her local library’s fundraiser dinner. what critical detail must she have before she starts designing the brochure?
Answers: 1
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 01:00, Ltik11900
Write the command that can be used to answer the following questions. (hint: try each out on the system to check your results.) a. find all files on the system that have the word test" as part of their filename. b. search the path variable for the pathname to the awk command. c. find all files in the /usr directory and subdirectories that are larger than 50 kilobytes in size. d. find all files in the /usr directory and subdirectories that are less than 70 kilobytes in size. e. find all files in the / directory and subdirectories that are symbolic links. f. find all files in the /var directory and subdirectories that were accessed less than 60 minutes ago. g. find all files in the /var directory and subdirectories that were accessed less than six days ago. h. find all files in the /home directory and subdirectories that are empty. i. find all files in the /etc directory and subdirectories that are owned by the group bin."
Answers: 1
Do you know the correct answer?
Write a program to solve a quadratic equation. The program should allow the user to enter the values...
Questions in other subjects:
![Konu](/tpl/images/cats/mat.png)
Mathematics, 04.05.2021 03:20
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/mat.png)
Mathematics, 04.05.2021 03:20
![Konu](/tpl/images/cats/mat.png)
Mathematics, 04.05.2021 03:20
![Konu](/tpl/images/cats/biologiya.png)
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/fizika.png)
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/mat.png)
Mathematics, 04.05.2021 03:20