We need at least 10 more requests to produce the answer.
0 / 10 have requested this problem solution
The more requests, the faster the answer.
Finish LOOP Statement and write If, THEN statement to make the following work. [-10, 0] f(x_1)...
1) Convert the "Switch" statement to "if/else" 2) Convert from for loop to while loop Convert the following "switch" statement to an equivalent "if/else": switch(x) case 10: cost- 1; break; case 20: cost- 2; break; default: cost 0; 0 if (cost =-1) x = 1; else if (cost-20) x = 2; else x = 0; O if ( x = 10) cost = 1; else if (x = 2) cost-20; else cost = 0; if (case10) cost 1; else if...
in c++ language 1.Re-write the following for loop statement by using a while loop statement: int sum = 0; for(int i=0;i<=1000;i++){ sum+=i; } 1 (b). Following is the main () function of a program. The program asks a user to enter 150 integers and print the largest integer user entered. int main() { int score, highest; //missing portion of the program return 0; } 1(c). Find the missing portion of the following code, so the...
I am having trouble on what exactly to write so I can make the script work, can someone show how to properly do it? Use the vi editor to enter the following script (name this file testscript): #!/bin/bash #script to demonstrate : reading arguments from a command line & # interactively from within script # selection (if… then… else…. fi) # iteration (for loop) # USE FILES ENTERED ON THE COMMAND LINE echo The script you are running is $0...
In C++, make the following binary search function work on an array of strings to give you the index location of the string you want in the array. It currently works on integers only. int binarySearch(int arr[], int firstIndex, int lastIndex, int target){ int index; if (firstIndex>lastIndex) index = -1; else { int mid = firstIndex + (lastIndex - firstIndex) / 2; if (target == arr[mid]) index = mid; else if (target < arr[mid]) index = binarySearch(arr, firstIndex, mid -...
Summary In this lab, you add a loop and the statements that make up the loop body to a Java program that is provided. When completed, the program should calculate two totals: the number of left-handed people and the number of right-handed people in your class. Your loop should execute until the user enters the character X instead of L for left-handed or R for right-handed. The inputs for this program are as follows: R, R, R, L, L, L,...
10. Write the heading (the first line) of a for statement whose loop control variable alpha counts from 37 through 1 in steps of 1. 11. What is the output of the following code fragment? (All variables are of type int.) limit 8 cout <<'H loopCount = 10; do cout x 'E; loopCount++ } while (loopCount <= limit); cout << "LP"
Re-write the following if statement structure as a SWITCH/CASE statement in C++ and Pseudocode: X ← 1 A ← 3 IF (a is equal to 1) THEN x ← x + 5 ELSE IF (a is equal to 2) THEN x ← x + 10 ELSE IF (a is equal to 3) THEN x ← x + 15 ELSE IF (a is equal to 4) THEN x ← x +...
I need someone to fix my C Program Code Firstly I will post the Q and the input and the outputs Then the code Secondly the code =================================== #include <stdio.h> #include <math.h> int main() { double a,b,c,d,l,x,x_0,x_1,x_mid,p_x,p_0,p_1,p_mid,E=1e-6; int i1,i2; printf("Enter a,b,c,d of ax^3+bx^2+cx+d=0: "); scanf("%lf%lf%lf%lf",&a,&b,&c,&d); x_0=-50;x_1=-50;x=-50;p_0=a*(pow(x_0,3))+b*(pow(x_0,2))+c*x_0+d;i1=0;i2=0; do{ p_x=a*x*x*x+b*x*x+c*x+d; l=p_x*p_0; if(l<0){ x_1=x;} i1=i1+1;x++;} while(fabs(p_x)>=E && x<50); if(fabs(p_x)<E){ printf("the polynominal has root...
7. Calculate L(f, P) and U(f, P) (as defined in lecture) for the following. Make sure to justify your work, especially your m, and M, computations. (a) f(x)-ln(x), x E [1,2]; an arbitrary partition P {xi);-o. ππ 4' 2' -1 if EQ-1,1]; any parti ifEQ (c) f(x)= 7. Calculate L(f, P) and U(f, P) (as defined in lecture) for the following. Make sure to justify your work, especially your m, and M, computations. (a) f(x)-ln(x), x E [1,2]; an arbitrary...
as 6. Rearrange the following. Remember to write pm() a. Make L the subject of f = 2xVLC b. Make M the subject of T = M-m 1+Mm c. Make h the subject of A = arvr2 + h2 d. Make R the subject of V = m (3R2 + h?) 7. Solve the following: a. Solve x + 2 + 2x = 4. Give the smaller value. b. Give the larger value to part 7.a. c. Solve x +...