answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kirill115 [55]
2 years ago
12

Write the definition of a function named quadratic that receives three double parameters a, b, c. If the value of a is 0 then th

e function prints the message "no solution for a=0" and returns. If the value of "b squared" – 4ac is negative, then the code prints out the message "no real solutions" and returns. Otherwise the function prints out the largest solution to the quadratic equation.
Computers and Technology
1 answer:
VMariaS [17]2 years ago
5 0

Answer:

#include <iostream>

#include <cmath>

using namespace std;

//initialize function quadratic

void quadratic(double, double, double);

int main() {

   //declare double variables a, b and c

   double a,b,c;

   //take input from user

   cin>>a>>b>>c;

   //call function quadratic

   quadratic(a,b,c);

return 0;

}

void quadratic(double a, double b, double  c){

   double root,n;

   //check if variable a is equal to zero

   if(a==0){

       cout<<"no solution for a=0"<<endl;

       return;

   }

   //check if b squared - 4ac is less than zero

   else

   if(((b*b)-(4*a*c))<0){

       cout<<"no real solutions"<<endl;

       return;

   }

   //print the largest root if the above conditions are not satisfied

   else{

       n=((b*b)-(4*a*c));

       root=(-b + sqrt(n)) / (2*a);

       cout<<"Largest root is:"<<root<<endl;

   }

   return ;

}

Explanation:

Read three double variables a, b and c from the user and pass it to the function quadratic. Check if the value of variable a is equal to zero. If true, print "no solution for a=0". If this condition is false, check if b squared - 4ac is less than zero. If true, print "no real solutions". If this condition is also false, calculate the largest solution using the following formula:

largest root = (-b + square root of (b squared - 4ac)) / (2*a)

Input 1:

2 5 3

Output 2:

Largest root is:-1

Input 2:

5 6 1

Output 2:

Largest root is:-0.2

You might be interested in
Axel is finally documenting his work. What could he be writing?
allochka39001 [22]

Answer: maybe his wrtting ezam

Explanation:

7 0
2 years ago
Write a single statement that will print the message "first is " followed by the value of first, and then a space, followed by "
nadezda [96]

Answer:

print("first is "+str(first)+" second = "+str(second))

Explanation:

The above written print statement is in python language.If first and second are strings then we need not to use str then we only have to write variable name.This statement prints the given in one line according to the question and it goes to new line after printing.

8 0
1 year ago
Suppose you are given an unknown chip which could be any one of the of the following: 7400, 7402, 7404, 7408, 7410, 7420, 7427,
Olenka [21]

The answer & explanation for this question is given in the attachment below.

3 0
1 year ago
How can migrating to an enterprise platform solution help a business improve employee productivity?
Lorico [155]

Answer:

By allowing all employees to access and share the same stored dats and by increasing the number of wmployees in business activities

Explanation:

#<em>carry on learning</em>

5 0
1 year ago
Which process is used to protect transmitted data in a vpn?
wlad13 [49]
Here is the answer: <span>Tunneling</span>
3 0
1 year ago
Other questions:
  • In three to four sentences, describe why CEOs (the chief executive officers, that is, the leaders of large companies) make very
    9·1 answer
  • Suggest two other subtasks that may be performed in a dice game?
    15·2 answers
  • Which of the following people is required by law to wear a seat belt? A. The operator of a truck weighing more than 26,000 lbs B
    15·1 answer
  • An online game is played with two dice. In this context, explain what is meant by decomposition in a simple way.
    15·1 answer
  • When Jen is planning to upgrade to a monitor with a better resolution, what should she be looking for in the new monitor? machin
    11·1 answer
  • "Suppose there is a class Alarm. Alarm has two class variables, code which contains a String value representing the code that de
    10·1 answer
  • Which type of styles can be applied to a word, phrase, or sentence?
    7·1 answer
  • A function defined beginning with void SetNegativesToZeros(int userValues[], ... should modify userValues such that any negative
    12·1 answer
  • Which decimal value (base 10) is equal to the binary number 1012?
    5·1 answer
  • Which of the following is not true of how computers represent complex information
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!