Problem 3: Using conditional operators, write a program to compute and print the 2 values of x in the equation: 2 Ax + Bx + C = 0 The values of A, B, and C are to be entered from the keyboard. If the root of the equation is imaginary, print "The root is imaginary.". Sample Input/Output: Enter the values for A, B and C: The roots of the equation are: X1 = 5 Enter the values for A, B and C: // 5 5 5J The root is imaginary. // 1 -3 -10 J X2 = -2 %3D %3D
Q: Two cars A and B leave an intersection at the same time. Car A travels west at an average speed of x…
A: Program code: //include the required header files#include <iostream>#include…
Q: Write a C++ program to convert temperature in degrees Fahrenheit to degrees Celsius. Your program…
A: ALGORITHM:- 1. Take inout for the Fahrenheit temperature from the user. 2. Convert it to Celsius…
Q: Write a program to input for a number, if the number is palindrome, then display its half on the…
A: Note: In this question, the coding language is not specified then we are doing this question in the…
Q: Example ( 7 ) : Draw a flowchart for program print the first ten natural numbers ?
A: Start 1. Declare variable i=1 2. Check if i is less than equal to 10 If yes…
Q: create a flowchart and a c++ program that will compute the real state tzx, given the following…
A: EXPLANATION: - The variables of type double are declared and initialized as: - double…
Q: 1. In order to discourage excess electric consumption, an electrical company charges its customers a…
A: flowchart for problem 1 calculate electric bill
Q: Draw a flowchart of the following code, and show the output if x = -3 and y = 3.
A:
Q: 1. Given two numbers X and Y. Write a program to determine the difference between X and Y. If X - Y…
A: “Since you have asked multiple questions, we will solve the first question for you. If you want any…
Q: Example01: If the user enters 5 as an input for quantity. Then enters 10, 4, -1, -100, and 1. Your…
A: Required:
Q: Q 2 / Write a program using the conditional function ( if ) to calculate the equations shown in the…
A: Input : Value of x Value of y Output : Value of q
Q: For each of the following Boolean expressions, assume that x = 1, y = 2, z = 3, and decide if they…
A: The question is solved using programming and mathematical logic. Please find the answer and the…
Q: I/A) Write an algorithm, draw a flowchart, and write a C++ program to evaluate the value of Y x2+5x…
A: Algorithm: Start Read x value If x=0, set y=0 Else if x>0 set y=(x*x+5*x-20)/sqrt(2*x) Else set…
Q: if-else-if statement Problem 3. Given two numbers X and Y. Write a program to determine the…
A: As per guidelines, we have to give solution only one problem at a time and I'll give solution for…
Q: Using switch statement, write program c++ that displays the following menu for the food items…
A: Algorithm Start Char c, int q Accept dish from user Accept quantity from user Calculate total price…
Q: Given 3 integers, output their average and their product, using integer arithmetic. Ex: If the input…
A: ACTUALLY FLOATING POINT ARITHEMATIC TAKES CEIL VALUE:
Q: Write program c++ to input a variable can accept any of the following value: A, & , B, 1, *, 3 as…
A: Sample Response: //C++ program to accept a value and prints its data type and…
Q: Draw a flowchart to read A, B, and C, and calculate and print Z the condition of the following…
A: The flowchart is below:
Q: - program to convert temperature from Fahrenheit to Celsius degree. Test Data Input a degree in…
A: Lets see the solution.
Q: Using C++, write a program that will check the employees years in service and office. The user will…
A: Given: Using C++, write a program that will check the employees years in service and office. The…
Q: write a program which accept days and integer variable and display total number of years, month and…
A: Actually, program is a executable software that runs on a computer.
Q: Draw the flowchart then write the C program using else if. The program reads one integer number x.…
A: Flowchart is a type of design that represent the steps, procedure or workflow of programming logic.…
Q: write c # program asking the user to enter the hour in seconds and then convert it into hours,…
A: A C# program is as follows, File name: “main.cs” using System; class Sample { /* Define the…
Q: Write a program using flowchart (or python, c++) that computes for the average of scores of a…
A: C++ code: #include <iostream>using namespace std; int main() { int marks[99], m, i, a=0,…
Q: Problem 4. Write a program that will accept the tuition fee and compute the total tuition fee based…
A: The Answer is in Below steps
Q: 2. Write a program that decides whether a leap year is a number requested from standard input. A…
A: #include <iostream>using namespace std; int main() { int year; cout << "Enter a…
Q: Assume that x is 3 and y is 5. Write the values of the following expressions: a. x == y b. x >…
A: x = 3 y = 5 a. x == y 3 == 5 False Answer is False b. x > y-3 3 > 5-3 3…
Q: if-else-if statement Problem 3. Given two numbers X and Y. Write a program to determine the…
A: logic:- read x and y if x-y<0 then R=x+y else if x-y==0 then R=2*x+2*y else R=x*y display x,y…
Q: Write a C++ program to input student name and marks of three subjects ,and calculate average, and…
A: Algorithm: 1. Declare score and grades. 2. Input score. 3. If score greater than 100 or less than 0…
Q: A golf ball is dropped from an airplane. The distance, d, the ball falls in t seconds is given by…
A: totDistance = 0.5*Gravity*time*time; distance = totDistance - distance;
Q: Suppose x = 1, y = -1, and z = 1. What is the printout of the following statement? (Please indent…
A: As per our company guidelines, we are supposed to answer only 1 of your questions. I have answered…
Q: Use a user defined function and appropriate conditional and looping statements to create a program…
A: NOTE: since you have not mentioned your preferred programming language, I am attempting this in…
Q: PROBLEM 5: Using if-else /Nested if-else if structure, write a complete program a.) that will…
A: Since programming language is not mentioned we are going to solve the problem in cpp language
Q: Q7 Draw the flowchart and write a C program using else if to calculate the total amount to be paid…
A: The program prompts the user to enter basic loan amount and number of years. Basic loan amount is…
Q: 3. Write a program to calculate the distance travel using the given formula below: S= vt + at2 In…
A: Step 1: Start Step 2: Enter the values of velocity, acceleration and time_travel Step 3: Calculate:…
Q: 3. Write a program that outputs the value of x given by the formula X = 5(a+cos (π/3))" √(a²+b²)…
A: Below I have provided Java Programming. Also, I have attached the screenshot of the code and output…
Q: Write 2 different programs using if statement and switch statement that will ask the user which…
A: #include<stdio.h>int main(){ double firstN, secondN; char ch; printf("Enter the…
Q: 2. Write a C program to accept the radius of pizza as input by the user. Calculate the price of the…
A: Step-1: StartStep-2: Declare two variables radius, priceStep-3: Take input for radiusStep-4:…
Q: Problem 5 Using if -else /Nested if- else if structure, write a complete program a.) that will…
A: 1) read three numbers 2) compare three numbers using if else , and determine maximum and minimum…
Q: write a program c++ If money is left in a particular bank for more than 5 years, the bank pays…
A: Given: write a program c++ If money is left in a particular bank for more than 5 years, the bank…
Q: Using user defined function and appropriate conditional and looping statements, create a program…
A: CODE:- #include<iostream>using namespace std;int payment(int tot){ int paym; do{…
Q: Question 3 Construct a C code, to enter 10 numbers (1-10), Print odd and even numbers. The output…
A: here in this question we have asked to write a program in c which take 10 input from user and…
Q: Write a program that specifies whether a given number (x) falls in one of the following categories…
A: Given: categories: • 0 to 9 • 10 to 19 • 20 to 29 • None Task: to find in which category, entered…
Q: Draw flowchart and write C program to input the value of Basic salary and calculate the new salary…
A: Explanation for Flow chart: First start FC by start symbol oval in shape. Now draw user input…
Q: Write a C program to input the user choice to calculate Total Salary or Monthly expenditure. If…
A: Program code: //include the required header files#include <stdio.h>#include…
Q: Q8 Draw the flowchart and write a C program using switch. The program inputs the currency and total…
A: PROGRAM EXPLANATION: - The input for the currency is taken using getchar() and stored in currency…
Q: This progran will output a parallelogram. How long do you want each side to be? 5 Please enter the…
A: 1. Implementation of the repeatChar(numRepeats, outputChar) method: def repeatChar(numRepeats,…
Q: ANSWER IN C++ WRITE A PROGRAM TO CALCULATRE THE AREA OF A RECTANGLE OF LENGTH =5 CM AND…
A: Programming in C++: C++ provides many features, standard libraries, rules to solve problems through…
Q: Write a program to determine whether a year entered through the keyboard is a leap year or not. Also…
A: Program approach:- Using the necessary header file. Add your own birth year and other stuff below.…
Q: C program Problem: Read your name and one numeric value [Omani Rial], print the following menu as…
A: First, we will enter the name of the user. Then we will enter the amount in Omani Rial. Then a…
Step by step
Solved in 3 steps with 3 images
- Numerical analysis) Given a number, n, and an approximation for its square root, a closer approximation of the actual square root can be found by using this formula: newapproximation=(n/previousapproximation)+previousapproximation2 Using this information, write a C++ program that prompts the user for a number and an initial guess at its square root. Using this input data, your program should calculate an approximation of the square root that’s accurate to 0.00001. (Hint: Stop the loop when the difference between the two approximations is less than 0.00001.)(Electrical eng.) a. The voltage gain of an amplifier is given by this formula: voltagegain=[275 23 2 +0.5 f 2 ]n f is the frequency in Hz. n is the number of stages in the amplifier. Using this formula, write, compile, and run a C++ program to determine the value of the voltage gain for a four-stage amplifier operating at a frequency of 120 Hz. Your program should produce the following display: At a frequency of xxxxx hertz, the voltage gain is yyyyy Your program should replace xxxxx with the frequency and yyyyy with the voltage gain. b. Manually check the value your program produces. After verifying that your program is working correctly, modify it to determine the voltage gain of a 12-stage amplifier operating at a frequency of 9500 Hz.If money is left in a particular bank for more than 5 years, the bank pays interest at a rate of 4.5% of the money; otherwise, the interest rate is 3.0% of the money. Write a c++ program to accept the number of years in the variable numYears and money in the variable money then display the correct interest rate, depending on the value input into numYears by using functions.
- Using the user-defined function and appropriate conditional and looping statements, create a program using C++ language that will: (a) ask the item price from the user (b) ask how many items to purchase for a specific item price (c) ask if there are other items to purchase, if yes, repeat the first step, proceed to the next step if otherwise (d) compute and display for the total amount to pay (e) ask for the payment from the user (f) accepts only enough amount of payment, ask another payment if otherwise (g) compute and display changeUse Python to write a program that can do both (examples in pictures). Hint: think of this as a program to output two triangles, one above the other (the longest horizontal line is the border between the triangles). Should have: 1. Your program must work with any length greater than 1. 2. Your program must use the character the user inputs to draw the parallelogram. 3. Your program must use a main() function (no global variables or global code other than a call to main within an if-statement) 4. Your program must also use the following function: def repeatChar(numRepeats, outputChar): ''' output the outputChar numRepeats times ''' for colNo in range(numRepeats): print(outputChar, end='')Please use C Program In order to discourage excess electric consumption, an electrical company charges its customers a lower rate of P75 for the first 250 kilowatt-hours and a higher rate of P8.5 for each additional kilowatt-hour. In addition, a 10% surtax is added to the final bill. Write a program that calculates the electrical bill given the number of kilowatt-hours consumed as input. At the end, print the number of kilowatt-hours consumed and the computed bill.
- C++ Programming Exercise: A real estate office handles, say, 50 apartment units. When the rent is, say, $600 per month, all the units are occupied. However, for each, say, $40 increase in rent, one unit becomes vacant. Moreover, each occupied unit requires an average of $27 per month for maintenance. How many units should be rented to maximize the profit? Write a program that prompts the user to enter: a. The total number of of units. b. The rent to occupy all the units. c. The increase in rent that results in a vacant unit. d. Amount to maintain a rented unit. The program then outputs the number of units to be rented to maximize the profit.ANSWER IN C++ WRITE A PROGRAM TO CALCULATRE THE AREA OF A RECTANGLE OF LENGTH =5 CM AND BREADTH=8CM. CALCULATE THE PRICE OF AN ITEM COSTING 100 GHANA CEDIS AFTER A DISCOUNT OF 10% IS APPLIED TO IT. WRITE A PROGRAM TO CALCULATE THE SIMPLE INTEREST ON A LOAN AMONUT OF 50000 GHANA CEDIS AT AN INTEREST RATE OF 30% FOR A NUMBER OF YEARS WHICH WILL BE SPECIFIED BY THE USER. WRITE A PROGRAM TO CALCULAT THE AGE OF THE USER AFTER THE USER ENTERS HIS OR HER YEAR OF BIRTH.Write the program to take input for a number if the number is palindrome,then display it's half on the screen, otherwise take input for two numbers, and display there product on the screen. Use minimum two functions including main function.
- The program below a needs `else` clauses for the conditions in lines 22 and 23. The problem is that the program does not output any information when the conditions in those lines fail --the program should instead alert the user that the input values do not correspond to a triangle.For example, try a=1, b=1, c=5; or a=3, b=5, c=1 # Entering the sides of triangle a = int(input("Enter the length of first side :"))b = int(input("Enter the length of second side :"))c = int(input("Enter the length of third side :")) # CHECKING WHETHER TRIANGLE IS VALID OR NOT LINE 22 if(a + b >= c): LINE 23 if(a + c >= b): if(b + c >= a): print("Triangle is Valid") print("Perimeter is:",a+b+c) else: print("Triangle is Invalid")Write a program to input for a number, if the number is palindrome, then display its half on the screen otherwise take input for 2 more numbers, and display their product on the screen. use minimum two function including main function.Question 3 Construct a C code, to enter 10 numbers (1-10), Print odd and even numbers. The output of your program should be: Enter 10 numbers: 1 2 . . 10 Odd number: 1 3 5 7 9 Total: 25 Even number: 2 4 6 8 10 Total: 30