3) Write a general program that computes the values e by using the following equation. Calculate the output when x=3. The equation must have 15 terms with x. 2x (2x) (2x) e =1+ 1! 2! 3! Do not write the program by simply adding the terms in the equation. You are allowed to use "math.h" functions.
Q: 4. Write a function to compute the following: i.e. the area and perimeter circle as given below. No…
A: import math #to use value of pidef areaperi(r): area = math.pi*r*r perimeter = 2*math.pi*r…
Q: B// List the error (if it found) for the following program ,then correct them, rewrite the program…
A: Need to find out error in the given code Program is written to calculate value of y, where a and b…
Q: 17. Write a program that calculates and print the numbers (from 0 to 10) and it squares and cubes.
A: Mathematically we know that square of a number is its multiplication by itself. For example if n is…
Q: c++ Given two sequences with n integers between 0 and 9, interpreted as two n-digit integers,…
A:
Q: C++ Have the user input a Float (ex: -15.750) and the output must display the following: Float…
A: c++ program to input the float value and print it into IEE 754 representation.
Q: Please explain why this code has program output: **********
A: The solution to the given problem is below.
Q: 1- Referring to the following flowchart, write a C++ function that implements Bisection Method.…
A: As per our guidelines, we are supposed to answer only one question. Kindly repost the remaining…
Q: Q1/an A-Write a program to compute the drag force F, (in Newton) When a body swims through fluid,…
A: Logic:- Given values of p=1000 vinf=1.25 A=0.25 Cd=0.09 We have to calculate Fd, Given formula:-…
Q: Write assignment statements that perform the following operations with int variable i, double…
A: Given: Write assignment statements that perform the following operations with int variable i, double…
Q: Write true if the two statements are equivalent; otherwise write false. 1. ∼(∼p∨q) and p∨∼q 2. p…
A: Given that 1. ∼(∼p∨q) and p∨∼q 2. p and ∼(∼p) Those two are the statements check whether these are…
Q: 28. If originally x=4, what is the value of x after the evaluation of the expression: x+=4
A: Given, x = 4. The value of x after the evaluation of the expression: x+=4 is 8.
Q: Q2: Write a program to compute and display a person's weekly salary as determined by the following…
A: Since no programming language is mentioned, I am using python. Algorithm: Start Read no.of hours n…
Q: 2. Write a program to find value of z according to the following equations: Z-xty when r-1 Z-X-y…
A: 2. Purpose: The main purpose is finding the value of z that is by given equations and in…
Q: Q2: complete the function that returns the area of a circle with radius r, note, use math.pi for pi.…
A: Python code for above : import math def circle_area(r): # calculate rae area = math.pi…
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: 6.29 LAB: Max and min numbers Write a program whose inputs are three integers, and whose outputs are…
A: Answer: step 1: take three inputs step 2 : define two functions one for finding largest among three…
Q: Write the input statement to get float input from the user with a prompt message as "Enter Float…
A: Given Write the input statement to get float input from the user with a prompt message as "Enter…
Q: 2- Write a pyhton function that prompts the user to input three integers and prints the sum of those…
A: Given: 2- Write a pyhton function that prompts the user to input three integers and prints the sum…
Q: 16. Write a program that will display the following pattern, given the value of n and m. Example if…
A: We have to write a C program to print the pattern as given. Here n (number of columns) and m (number…
Q: 2. Write a program to input a number x from the keyboard. If the number is larger than 0, find its…
A: The problem is based on finding the square or square root of a number depending on its value.
Q: Please revise the program and correct the errors of the program and make varaibles a and b not…
A: Using the member functions setA and setB of Struct X, the values of a and b are given to the…
Q: 2. Write a general short program that prints the output below. You can use a maximum of 3 cout…
A: code: #include <iostream> using namespace std; int main() { for(int x = 0; x < 5; x++) {…
Q: Q2)- Choose the correct statement 1- To change the text x to capital letters, use the function : a)…
A: Please find the answer below
Q: 3- The below program has errors, trace the below program and mention the errors: # include int main…
A: - We have to correct the code removing the errors.
Q: Exercise 5: Write a C++ program that asks the user to enter the value for input variables, and…
A: The c++ code along with the output for division operation has given is step 2.
Q: Q2) Write a program to solve the following equation: xa + ya? + z*
A: According to the information given:"- We have to define the write program to solve the mention…
Q: 2. The coordinates of two two-dimensional points P 1 (x 1 ,y 1) and P 2 (x 2 ,y 2) are input through…
A: A line is passed through the points P1(x1, y1) and P2(x2, y2) then equation of that line is, y - y1x…
Q: 2. Write the statements to sum the odd integers between 1 and 99 by using a for statement. Assume…
A: Here we have written a c program to print the sum of the odd integers between 1 and 99 using for…
Q: complete the function that calculates the Euler's number e from the series you learnt during the…
A: 1. e and x are given 2. loop from 0 to n i. add math.factorial(i) to e ii. if x have other…
Q: Q1: Write a program to compute the following equation (Y=5x2 + 2), when the .input values greater…
A: For question 1 the answer is the following code : #include<stdio.h>#include<conio.h>…
Q: 3. Question 1 Write a program which takes two float number from the user and check, if first number…
A: Since you are not specify any language for implementation, I choose C language. Program #include…
Q: One lap around a standard high-school running track is exactly 0.25 miles. Write the function…
A: Program code: #define function miles_to_laps def miles_to_laps(user_miles): #return laps…
Q: Q/ A College of engineering is advertised to call high school graduates to apply to its departments…
A: Problem Statement: A College of engineering is advertised to call high school graduates to apply to…
Q: 3. Write a code that accepts any number and compute the sum from 1 to the Nth number. If the user…
A: #include <iostream>using namespace std; int main(){ int n; cout<<"Enter a…
Q: Write a program calculating the area of a triangle with the length of the three sides as a, b, c,…
A: Task :- Write a program to calculate the Area of given triangle . C++ program :- #include…
Q: Find the errors in the following program: void sum(int x1, x2, x3)
A: subject : C++ Programming Find the error in the following program void sum(int x1,x2,x3) {…
Q: (Diameter, Circumference and Area of a Circle) Write a program that reads in the radiusof a circle…
A: #include <stdio.h> int main() { float r; printf("enter radius :- "); scanf("%f",&r);…
Q: Write assignment statements that perform the following operations with int variable i, double…
A: GIVEN: int i; double d1, d2; char c; A) Subtract 8.5 from d2 and store…
Q: (c) You are required to create a program that reads a letter of the alphabet from the user. If the…
A: We want to check if the letter input is vowel or not, for y we have added a check, and printed…
Q: Problem 2. (Playing the Waltz) Write a program called playwaltz.py that accepts from standard input,…
A: Write a program playvalt2.py that accepts from standard input, a sequence of 32 integers…
Q: Print the odd numbers between (100,200) using function void odd (int).
A: Here, Code instruction is given to print odd numbers between 100 and 200.
Q: Point out the errors if any in the following part of the program in c++ void main() { int…
A: void main() { int a=30; f(); // function call } void f() //function definition { int b=10;…
Q: 1.Use Bisection Method to find out the root of x – sin(x) – 0.5 = 0 between 1 and 2 intervals (…
A:
Q: average(double X, double y, double 2), returning he average of the arguments
A: Given 1. Write the following methods and provide a program to test them . b. double average(double…
Q: 3. Write a computer program to solve the quadratic equation below: ax²+ bx + c = 0 The input data is…
A: Program: Programs are used to solve complex problems. The main objective of the program is…
Q: 8- Write an algorithm (flowchart) to decide whether a number X (3 < X < 22) is a prime or not a…
A: PROGRAM CODE: #include <stdio.h> void main(){ int num,i,ctr=0; printf("Input a…
Q: 2- Write a program to enter(15) numbers by using inputbox function and then find the average of…
A: 1. declare two functions textbox and input box.2. in inputbox function take the 15 numbers from…
Step by step
Solved in 2 steps with 1 images
- (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.C++ Have the user input a Float (ex: -15.750) and the output must display the following: Float Number (what the user inputted), Sign (If the user inputted a positive or negative Float), Whole (binary), Fractional, Exponent, Mantissa and IEE 754. NO library functions like atoi. These are the steps that I have so far: Input a Float Check if Float is Pos or Neg -> store 0 or 1 (and then make it positive to make it easier) Split the float into whole (int) and fractional (float) Convert whole number into binary (if whole == 0) like (0.1231), then just store 0 into the binary Convert fractional to binary Find exponent bias Convert exponent bias to binary Create the mantissa Create IEE754 (the whole thing) OUTPUT: Float Number: Sign: Whole (Binary): Fractional: Exponent: Mantissa: IEE 754: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.
- 3 Write two different functions which have the following results with input 1 and 2. It means that these two different functions are equivalent at input 1 and input 2.Find the error in each of the following program segments and explain how the error can becorrected (see also Exercise 5.46):a) int g(void){printf("%s", Inside function g\n");int h(void){printf("%s", Inside function h\n");}}b) int sum(int x, int y){int result = x + y;}c) void f(float a);{float a;printf("%f", a);}Display the first N magic numbers, where N is a positive number that the user provides as input. Here, a magic number is a number whose sum of its digits eventually leads to 1. For example, 1234 is a magic number because 1 + 2 + 3 + 4 = 10 and 1 + 0 = 1, while 1235 is not (1 + 2 + 3 + 5 = 11 and 1 + 1 = 2). Write a program that prints out the first N magic numbers, seven on each line. You are required to use the following function prototype: bool isMagic(int value); // Returns true if value is a magic number The outline of this function will be as follows: Step 1: Calculate the sum of digits of the value Step 2: Repeat Step 1 until we get a single-digit Step 3: If the resulting sum is equal to 1 then it is a magic number, otherwise not Here is the sample output:
- 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.Write true if the two statements are equivalent; otherwise write false. (p∨∼q) ∨q and p-Program C 2. Not my Favorites by CodeChum Admin We've already done looping through a series of numbers and printing out its squares, so how about we level it up and go with cubes this time? I have a condition though; I don't want to be associated with numbers that are divisible by 3 or 5 so if an integer is divisible by either of the two, don't make their cube values appear on the screen, please. Care to fulfill my request? Instructions: Print out the cube values of the numbers ranging from 1 to 1000 (inclusive). However, if the number is divisible by either 3 or 5, do not include them in printing and proceed with the next numbers. Tip: When skipping through special values, make use of the keyword continue and put them inside a conditional statement. Output Multiple lines containing an integer. 1 8 64 343 512 . . .
- Point out the errors if any in the following part of the program in c++ void main() { int a=30; f(); } void f() { int b=10; }3. Write a program to take 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 functions including main function.Use Type Switches and Asertions sparingly function to write go code. Question is right , please donot reject it Output 70< nil>