Concept explainers
Write a
Your program is to prompt the user to enter the constants (a, b, c). It is then to display the roots based on the following rules:
a. If both a and b are zero, there is no solution.
b. If a is zero, there is only one root
c. If the discriminate
d. For all other combinations, there are two roots.
Test your program with the data in Table 5-13.
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Computer Science: A Structured Programming Approach Using C, Third Edition
- in python: Write a program whose inputs are three integers, and whose output is the smallest of the three values. Ex: If the input is: 7 15 3 the output is: 3arrow_forwardWrite a program that reads a floating point number and prints "zero" if the number is zero. Otherwise, it prints "positive" or "negative" (as appropriate). Add "small" if the absolute value is less than 1, and add "large" if the absolute value is greater than 1000. PYTHONarrow_forwardWrite a program that prompts the user to input any digit then swap the position of the first and the last digit. Next, the user will be prompt to select what arithmetic operation he/she want to employ on the first and last digit based on the following choices: 1. Sum of their square 2. Product of their square root 3. Square of their product The output will display the result of the arithmetic operation followed by the digit with a swapped position of “first” and “last” digit. Then finally display the equivalent uppercase alphabet for the first digit and lowercase alphabet for the last digit respectively after swapping. Note: 1. If the last digit of the inputted digit from the user is zero, it must display that there is no equivalent alphabet for that digit. 2. If the user chooses arithmetic operation No.2, format the output to three decimal places TEST CASES: If a user inputs a digit and choose arithmetic operation No.1: Input any number: 97834 Select an arithmetic operation…arrow_forward
- Write a PYTHON program that asks the user to input three numbers (x, y, z), and find the highest and lowest number, and output their difference.arrow_forwardUsing python, Write a program that displays a table of inches from 1-12 and equivalent lengths in centimeters. You can find the conversion factor online if necessary. Store this factor in a properly named constant in your program. Display the inches accurate to one decimal place in a column 6 characters wide and the centimeters accurate to two decimal places in a column 8 characters widearrow_forwardWrite a program that mimics a calculator. The program should take as input two integers and the operation to be performed. It should then output the numbers, the operator, and the result. (For division, if the denominator is zero, output an appropriate message.) Some sample output as follows: 3 + 5 = 8 4 * 7 =28 6 / 0 Error! Division by zero is not allowed.arrow_forward
- Write a program using python that will do simple math calculations using the basic operations. Refer to the sample output below. Ask for Input 1. First Number 2. Second Number Sample Output first·number: 87 second number: 9 The sum of 87 and 9 is 96.00 The difference of 87 and 9 is 78.00 The product of 87 and 9 is 783.00 The quotient of 87 and 9 is 9.67 The remainder of 87 and 9 is 6.00 The square root of 87.000 is 9.33arrow_forwardWrite a program that accepts a number corresponding to a plane figure: 1. Right Triangle 2. Rectangle 3. Circle The program will then ask for the following: base and height – if the previous input is 1 (right triangle) width and length - if the previous input is 2 (rectangle) radius - if the previous input is 3 (circle) If the user inputs 3(figure), 4.0(radius) Resulting area = 50.27, circumference = 25.13arrow_forwardWrite a program that inputs a sequence of non negative numbers terminated by a negative value and show the sum, average, maximum and minimum of the non negative numbersarrow_forward
- Write a program that takes an integer and prints the number of trailing zeroes. Trailing zeroes are the zeroes found at the right side of a number. Inputs 1. One line containing an integer Sample Output Enter the number: 24100 Trailing zeroes: 2 write a program using C language.arrow_forwardWrite a program in Python that calculates the area of a circle. Begin by assigning 3.1416 to a properly named constant, then prompt the user for the radius of the circle. The radius could be a large number with decimal places. Calculate and display the area accurate to three decimal places and with commas to indicate thousands, if necessary. Sample Output 1Enter the radius 12.5The area is 490.875 Sample Output 2Enter the radius 350.5The area is 385,946.345arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education