(B) Write a program that reads from the user the values of x and h to implement the equation below. -10x + 2h, √x -h, fx = x < 3 x ≥ 3
Q: Write a complete C program for the following question Write C program to find the result of X in the…
A: Required: Required code with comments for explanation and screenshot of both code and output has…
Q: Write a program in c++ that will allow a user to find the hypotenuse of a right triangle using the…
A: Given: We have to write a a program in c++ that will allow a user to find the hypotenuse of a…
Q: Write a program in C++ to calculate and print the Electricity bill of a given customer. The customer…
A: Please find the answer below :
Q: Write a program that generates a number randomly by using rand ( ) function and user will have to…
A: #include<iostream> #include<stdlib.h> #include<ctime> using namespace std; int…
Q: Can I please have the answer in C++ language 4.7: Time Machine Your time machine is capable of…
A: Lets see the solution.
Q: 3. For three resistors connected in series, the total resistance is the sum of the individual…
A: Given: Resistors are connected parallel Therefore Total resistance is Total Resistance =…
Q: 15. Consider the following program that attempts to compute the circumference of a circle given the…
A: Program Code: #include <iostream>using namespace std; #define PI 3.141 int main(){ float…
Q: Design a calculator application in Java and then code for the following functions a. Perform all the…
A: import java.util.*; // import Scanner class for reading input valuesimport java.lang.Math; // import…
Q: olve the below program in C language. Write a program in C to check armstrong and perfect numbers…
A: program code: #include <stdio.h> int checkArmstrong(int n1);int checkPerfect(int n1); int…
Q: Write a program to roll dice (use the “rand” function) for 36,000 times and then calculate the…
A:
Q: Problem 3. Provide short answers to the following questions: a. Write an example of a valid…
A: In effect, an argument is valid if the truth of the premises logically guarantees the truth of the…
Q: In C++, all code must be inside of the main function A) True B) False
A: Solution is given below :
Q: (b) What is the value of x after each of these statements is encountered in a computer program, if x…
A: Given: X value after statements was encountered.
Q: Write a program that prompts the user to enter the minutes (e.g., 1 billion), and displays the…
A: Store minutes as long int to store longer values
Q: Solve the below program in C language. Write a program in C to find the square of any number using…
A: the c code for the above requirement is as follows
Q: Write a program to compare two fractional numbers by overloading relational operators (,=,==, !=)…
A: //Executable code #include<iostream>#include<cstdlib>using namespace std; class…
Q: Write a program that will makes simple calculations. Use function for each operation.
A: To write a program that will makes simple calculations using function for each operation.
Q: 39. Write a program for the following problem. An instructor needs a program that accepts a student…
A: Given : semester average grade 90 -100 A 80-89 B 70-79…
Q: In C++, write a program whose inputs are three integers, and whose output is the smallest of the…
A: Given To complete the c++ program to find the smallest numbers from three integers.
Q: write a c++ program which will accept one integer argument from user and returns count of digits of…
A: I have provided solution in step 2.
Q: Qno. 1 () Construct a program where implicit conversion would have been done. ii) Construct a…
A: i) #include <iostream> using namespace std; int main() { //declaring int variable int…
Q: 3. Find the mistake in the following syntax: int x-10; printf("The value of x = %d",x) Mistake:
A: The printf() is a library function to send formatted output to the screen. Note: As per our…
Q: B) R1= 20, R2-40 resistors are connected in series and R3-120, R4-40 resistors are connected in…
A: Here, we have given a Circuit Diagram , with 4 resistances R1 , R2 , R3 , R4 and Voltage V. We have…
Q: Write a java program to calculate the following: Check whether the given number is prime no or not,…
A: INTRODUCTION: In the given problem, we are asked to write one java program with function overloading…
Q: Write a C++ program that reads in temperature in Celsius and displays temperature in Fahrenheit;…
A: The below is a temperature conversion formula that converts celsius to fahrenheit is as follows…
Q: Can someone help me answer this in Coral programming language? 1) The year must be divisible by 4…
A: Answer :
Q: 1-Compute the weakest precondition for the following statements A. x = 2* (y + 2*x); y=3*x-6 {y > 9}…
A: Complete answer is given below:
Q: PROVIDE CODEWrite a c++ program accepting a complex number. Overload the required operators to…
A: #include<iostream>using namespace std; class complex { int real, img; public:…
Q: The athlete is given two attempts to shoot. The highest score counts. From the list of attempts, get…
A: #include <bits/stdc++.h>using namespace std; int main() { int number_of_atheletes=0; //…
Q: 1. Examine the following code: After this code executes, what is the value of x? y? 2. Examine the…
A: 1) When the value of x = 9 and y = ++x Code ( in java ) - public class Main{ public static void…
Q: A C program contains the following declarations and initial assignments: int i= 8, j = 5; float…
A: ASCII value of c=99 ASCII value of d=100
Q: Write a program that reads the marks of a student in the test (te), midterm (mid), assignment…
A: I am uploading the handwritten solution in the next step. As there is no programming language…
Q: Q1. Write a program in G+ language to obtain the equation below, for values of x from (1~ 20), by…
A: Note: The set of possible input values for cos inverse function are [1,1]. But in the question, it…
Q: Q2: Using switch case, write C code for a program that reads two integer numbers A and B, and one…
A:
Q: Write a program in which child take the input from user and parent is required to print that input?
A: #include <stdio.h>#include <stdlib.h>#include <pthread.h>#include…
Q: Write C++ statements for the following arithmetic expressions. Assume A, B, C, D, X, Y, and Z are…
A: A * C B * D ----------- + -----------…
Q: Write a function called multiplyMe in c programming which has a variable number of integers as…
A: Algorithm: Start Read number of elements n Read n numbers in an array Implement a method named…
Q: Write a C++ program that calculates the area of a square. The main function asks the user to input…
A: PROGRAM INTRODUCTION: Include the required header files. Start the definition of the function to…
Q: Use C++ Write a program that simulates flipping a coin to make decisions. The input is how many…
A: For generating head or tail we had used rand() function. Algorithm- 1) ask number of times coin to…
Q: Provide your own short C++ code example that uses math operators of your choice. Try to use at least…
A: 100 + 10 is 110 as you can see in the output. We achieved this result of addition using the +…
Q: a) Compute the weakest precondition for each of the following assignment statements and post…
A: According to the information given:- We have to compute the weakest precondition for assignment…
Q: In c++ The name and value of variable can change while the program is running? Do you agree with…
A: The name and value of the variable cannot be changed while the program is running.
Q: 2. Write a program that computes the cost of painting and installing carpet in a room. Assume that…
A: Actually, program is a executable software that runs on a computer.
Q: Write a C program that reads the values of x (integer) and y (integer) and then calculates and…
A: Code: #include<stdio.h> int main() { int x,y,z; float res; printf("\nEnter the two…
Q: This is the formula for the standard normal deviate, z, used in statistical applications: z = (X-…
A: a. The standard normal deviation needs to be calculated. Hence, there will be only one output i.e.,…
Q: B) R1= 20, R2=40 resistors are connected in series and R3-120, R4=40 resistors are connected in…
A: First of all we would derive some formulas to use in our C++ code, We have to find Currents…
Q: Using C write a program that uses a recursive function to find the greatest common divisor of two…
A: I have provided C CODE along with CODE SCREENSHOT and 2 OUTPUT SCREENSHOTS---------------
Q: Write a program that will calculate and print bills for the city power company. The rates vary…
A: The C++ program with the given description will be created as follows: Declare int variables for ID…
Step by step
Solved in 2 steps with 1 images
- use c++ program A positive integer n is called prime if n > 1 and the only factors of n are 1 and n. It is known that a positive integer n > 1 is prime if n is not divisible by any prime integer m≤√n . The 1230th prime number is 10,007. Let t be an integer such that 2 ≤ t ≤ 100,000,000. Then t is prime if either t is equal to one of the first 1,230 prime numbers or t is not divisible by any of the first 1,230 prime numbers. Write a program that declares an array of size 1,230 and stores the first 1,230 prime numbers in this array. The program then uses the first 1,230 prime numbers to determine if a number between 2 and 100,000,000 is prime. If a number is not prime, then output at least one of its prime factors.Modify the below program that the input values representingfractions are stored with denominators that are positive integers. You cannot require the user to only enter a positive denominator value; the user should not be inconvenienced by such a restriction. For example, whilst values of 1 / -2 are acceptable inputs for a fraction, the output representation should be -1 / 2. Your solution should check the denominator input; if it is negative, swap the sign of both numerator and denominator instance variables. //Import the essential package import java.util.ArrayList; import java.util.Scanner; //Define the class Fraction class Fraction { private int n, d; public Fraction() { //Initialize the values this.n = this.d = 0; } public Fraction(int n, int d) { //Initialize the variables this.n = n; this.d = d; } //Define the getter function getNum() that returns the numerator public int getNum() {…Write a c++ code and test the “digit” function:Function Prototype: int digit(int n,int k)This function returns the kth digit of the positive integer n. For example, if n is the integer29,415, then the call digit(n,0) would return the digit 2, and the call digit(n,2) would returnthe digit 4. Examples:Input: n = 29415 , k = 1 output: 9Input: n = 2 , k = 0 output: 2 Input: n = 2 , k = 1 output: index out of bound (return -1) Note: The digits are numbered from left to right beginning with the “zeroth” digit. Take input and display output in main function. do not use string libruary. so do it using while , do while or for loop.
- Q2/ Write a program to express the equation below: x2 y3 z4 + 3 = A 6. 4 And find the A value if x = 5 store at DS 3000H and SI 200H, y =3 store at DS 1500H and SI 250H, and z=7 store at DS 2000H and SI 400H.Write a c++ code and test the “digit” function:Function Prototype: int digit(int n,int k)This function returns the kth digit of the positive integer n. For example, if n is the integer29,415, then the call digit(n,0) would return the digit 2, and the call digit(n,2) would returnthe digit 4. Examples:Input: n = 29415 , k = 1 output: 9Input: n = 2 , k = 0 output: 2 Input: n = 2 , k = 1 output: index out of bound (return -1) Note: The digits are numbered from left to right beginning with the “zeroth” digit. Take input and display output in main function.Write your own definition for the function absfun( ) which receives real number x as an argument and returns its absolute value (i.e. abs(x)=|x|). Use this function in a program that reads numbers from the keyboard and prints their absolute values. [Don’t use math library] Sample Run Enter x :-3 Output: abs(-3) = 3.00 in c language
- C++ Coding - Loops Party shop sells birthday gift bags in two ways. Customers canpurchase a set of 12 bags for $25.6 or an individual bag for $1.64.Write a complete program that asks the user input for the number ofgift bags need to be purchased (an integer) and outputs the total priceof the purchase. For example, if the customer buys 25 gift bags, the customer wouldbe charged for 1 set of (12 bags) plus another 13 individual bags.The subtotal would be 1(25.6) + 13(1.64) = $46.92 Use a constant variable to set a fixed tax rate of 8.875. Display correct dollar values (2 decimal places, use cout precision)What does the function return for any positive values of x and n ? The answer should be a general formula in terms of x and n. int what_do_I_do ( int x, int n ) { if ( n = = 1 ) return x; else return x + what_do_I_do ( x, n – 1 ); } C++ be quick pleaseImplement the following functions using c language. The functions return a real number: (a) Function Celsius returns the Celsius equivalent of a Fahrenheit temperature (Hint: 0 Celsius is equal to 32 Fahrenheit and 100 Celsius is equal to 212 Fahrenheit). (b) Function Fahrenheit returns the Fahrenheit equivalent of a Celsius temperature. Use these functions to write a program that prints charts showing the Fahrenheit equivalent of all Celsius temperatures between 0 and 100 degrees, and the Celsius equivalent of all Fahrenheit temperatures between 32 and 212 degrees. Print the output neatly in a table.
- Using Java The majority() function takes three boolean arguments and returns true if two (or more) of the arguments are true; and false otherwise. Complete two implementations of majority() below by filling in the letter of one of the expressions below in each provided space. You may use each letter once, more than once, or not at all (but you may not use any other code). A. false G. x && y H. x && z I. y && z J. x && y && z K. x || y B. true C. X D.y E. Z L.x || Z M. y || z N. x || y || z O. count++ wwwmmin P. count- Q. count R. count = 2Problem 7: Guess the price of the car!? You will implement a variant of the number guessing game we played in lecture. In this variant, you will ask the user to guess the price of a $42,500 car. Let's assume that the player knows the price of the car is rounded to the nearest $500. If a player's guess is not exactly correct, your program will tell them they are either too high or too low. The player will get as many guesses as they need to guess the price of the $42,500 car. However they will only win the game if they used 5 or fewer guesses. Here are two examples of how the program should work for both cases: Guess the price and win the prize! Enter your guess:50000 Too high! Enter your guess:40000 Too low! Enter your guess:45000 Too high! Enter your guess:42500 You won the car! Guess the price and win the prize! Enter your guess:46000 Too high! Enter your guess:45000 Too high! Enter your guess:44000 Too high! Enter your guess:43000 Too high! Enter your guess:42000 Too low! Enter your…Hi, I need help with the following assignment. Implement a program that reads in a year and outputs the approximate value of a Ferrari 250 GTO in that year. Use the following table that describes the estimated value of a GTO at different times since 1962. Year Value 1962-1964 $18,500 1965-1968 $6,000 1969-1971 $12,000 1972-1975 $48,000 1976-1980 $200,000 1981-1985 $650,000 1986-2012 $35,000,000 2013-2014 $52,000,000