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
Which statement accurately describes the clutter feature in outlook 2016
I am Lyosha [343]

Answer:

The answer is the last option

8 0
2 years ago
Ben uses a table that has few columns. He knows about a particular value in the first column and wants to find the corresponding
igor_vitrenko [27]
I'd suggest he uses LOOKUP Function.

You can use the LOOKUP function when you need to look in a single column or row and find a value from the same position in a corresponding column or row. We have a much improved VLOOKUP that can also be used to search one row or column or multiple rows and columns.



4 0
2 years ago
Read 2 more answers
(1) Prompt the user to enter five numbers, being five people's weights. Store the numbers in an array of doubles. Output the arr
Mashutka [201]

Answer:

weights = []

total = 0

max = 0

for i in range(5):

   weight = float(input("Enter weight " + str(i+1) + ": "))

   weights.append(weight)

   total += weights[i]

   if weights[i] > max:

       max = weights[i]

average = total / 5

print("Your entered: " + str(weights))

print("Total weight: " + str(total))

print("Average weight: " + str(average))

print("Max weight: " + str(max))

Explanation:

Initialize the variables

Create a for loop that iterates 5 times

Get the values from the user

Put them inside the array

Calculate the total by adding each value to the total

Calculate the max value by comparing each value

When the loop is done, find the average - divide the total by 5

Print the results

6 0
2 years ago
A small company has developed a specialized software product that it configures specially for each customer. New customers usual
egoroff_w [7]

Answer:

It would be good for the company to make the item open source since it lessens the progression costs and attempts.

If turned into open source then the code would be available to the customers and are they could to take off upgrades and modify it to their own specific needs. It reduces the company's efforts, satisfies the customers whilts including them.

6 0
2 years ago
Let S be the set of all strings from A* in which there is no b before an a. For example, the strings λ, aa, bbb, and aabbbb all
alexdok [17]

Answer:

Check the explanation

Explanation:

A recurvsive defintion for A^{*} which contains all possible strings over the alphabet A=\{a,b\}is \lambda\in A^*(contains the null strings) and A^{*}=\{uv:u\in A^*,v\in A\}

A recurvsive defintion for A^{+} which contains all possible strings over the alphabet A=\{a,b\} is a,b\in A^+ (contains the strings of lengths 1) and A^{+}=\{uv:u\in A^+,v\in A\}

c) \lambda \in S and

w\in S\Rightarrow wb \in S

bw\in S\Rightarrow baw \in S and awb\in S

is the required recursive definition for S

For example,a\in S and from w\in S\Rightarrow wa\in S\text{ we get }aa\in S also

Again, as ab\in Sand from wb\in S\Rightarrow wab \in S we get aab\in S

And as aab\in S, from wb\in S\Rightarrow wab \in S and awb\in S we have aaab\in S

3 0
2 years ago
Other questions:
  • Compare the encryption algorithms found in s-tools: idea, mdc, des, and 3des.
    5·1 answer
  • Give a recursive (or non-recursive) algorithm to compute the product of two positive integers, m and n, using only addition and
    8·1 answer
  • Consider an application that transmits data at a steady rate (for example, the sender generates an N-bit unit of data every k ti
    8·1 answer
  • Use the image below to answer this question.
    14·1 answer
  • Collaboration online increases students' motivation by
    5·2 answers
  • Thelma is a web developer for a bowling league. She wants visitors to the website to be able to print web pages, such as league
    14·1 answer
  • dam is writing a program that: 1) has the user guess a number, and 2) tells the user how many guesses it took to get the correct
    9·1 answer
  • During the boot process, what does the processor do after the computer circuits receive power?
    13·1 answer
  • In which of the following stages of the development process is a team MOST likely to interview a potential user of an app?
    6·1 answer
  • Sea level is the average level of the sea between high and low tide. It is used as a reference point for measuring elevation, or
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!