Output:
>> modify(0)
ans =
-5
In given code , if x is negative 10 is added to x and stored in y
else , 5 is subtracted from x and stored in y
modify(0) Here , x = 0 which is not negative
y = x - 5 = 0 - 5 = -5
Given the following custom function, what is the result of the function call: modify (0) function...
10) you will run/call the function with these given values. (b) Write a flow chart and the script file using conditional statements with logical operator if/else and if/elseif, to evaluate the following function, assuming that the scalar x has a value: y 2 sin(m) for-1 x < 5 y=10(X-5) + 1 for x 25 Use your file to evaluate y for x5,x 3 and x 15 by hand 10) you will run/call the function with these given values. (b) Write...
Write a program that contains a main function, a “double custom_operator_function(int op_type, double x, double y)”, a “double min(double,double)”, a double max(double x,double y), and a double pow(double x, int y). The main function is used to call the custom operator function. Next, the custom operator function calls the min/max/pow functions based on the op_type. From the main, call the custom operator function with the three inputs 1/-3/5, 2/4/5, and 3/4/5. Print the result of each input to screen. i)...
Given the following custom function: function [ tf ) - IsLeapYear( yr) (rem (yr, 100) ==06& rem (yr, 400) -=0) tf = 0; if rem (yr, 4) == 0 && tf = 1; end end What is the purpose of the variable "yr"?
Please answer question 8 Given the following method, what is the result of a call to System.out.println(foo(list)) if list contains { 1, 1, 2, 2 )? public Integer foo( IndexedunorderedList<Integer> list ) Integer bar = new Integer (0); 0; X < list.size(); x++) bar += list.get(x) * list.get (x); return bar; 30 is printed to the console 14 is printed to the console 10 is printed to the console Code throws an IndexOutOfBoundException QUESTION 8 What is the runtime of...
(5 pts) What is the ouput of the following function F, for the call int i = F(3)? int F(int n) { int result; if (n > 20) return 1; else { result = F(2*n) * 2; cout << result << " "; return result; } }
QUESTION 1 What will be displayed as a result of executing the following code? int x = 5, y = 20; x += 32; y /= 4; cout <<"x = " << x <<"y = " << y; A. x = 32, y = 4 B. x = 9, y = 52 C. x = 37, y = 5 D. x = 160, y = 80 8 points QUESTION 2 What will be the displayed when the following code...
PYTHON:please display code in python Part 1: Determining the Values for a Sine Function Write a Python program that displays and describes the equation for plotting the sine function, then prompts the user for the values A, B, C and D to be used in the calculation. Your program should then compute and display the values for Amplitude, Range, Frequency, Phase and Offset. Example input/output for part 1: Part 2: Displaying a Vertical Plot Header A vertical plot of the...
Problem (10 pts) Let a function g(a) be given by the following: cos(ma), 0, 0 < α < 2 else g(a)- Let p(t) 3g2 (4 -0.5t). Plot the p(t) waveform over the time range 0 ts 10.
You are given a finite step function xt=-1 0<t<4 1 4<t<8. Hand calculate the FS coefficients of x(t) by assuming half- range expansion, for each case below. Modify the code below to approximate x(t) by cosine series only (This is even-half range expansion). Modify the below code and plot the approximation showing its steps changing by included number of FS terms in the approximation. Modify the code below to approximate x(t) by sine series only (This is odd-half range expansion).. Modify...
MODIFY THIS LINK LIST USING C++: Write a function which determines if the values in the queue is divisible by 5 or 10 if true the value is divided by 5 void NumberList::listDivisibleBy5or10() ListNode* currentNode = head; //Pointer for current value in the link list if(!head) // checks for an empty link list { std::cout<<"The list is empty \n"; // tells user that the link list is empty } else { ...