Write a code that can find out the summation of the following series. - + * *+. X" (n+1)! 3! 4! Where, n is an odd number and n will be provided by the user. Do not use any built in function.
Q: What is wrong with the following function? bool Greater(int a, int b) { if (a > b)…
A: Given program: bool Greater(int a, int b) { if (a > b) return true; }
Q: 1c. What is the output of the following function? #include int fun (int n) int i, j, sum = 0; for…
A: Please find the answer below
Q: Q3: ) A: Write a program to find the value of (C) from the following function C=exp-Eb,-D where n-1…
A: Code: a=2:9; b=-15:3:6; n=length(a)-1; num1=0; denom1=0; bSum=0; for i=1:n…
Q: Write and test the following average () function that returns the average of up to three negative…
A: NOTE: As no language is mentioned, the code is written in C++. #include <iostream> using…
Q: Assume that N is a positive integer. Returns the sum from 1 to N inclusive, but omitting the numbers…
A: According to the provided information: We need to create a python program that calculates the sum…
Q: (7 What does this function do? SOURCE CODE 1. int T(int x, int y) 2. 3. int sum 0; 4. if (odd (x))…
A: C++ CODE #include <iostream>using namespace std;int T(int x,int y){ int sum=0;…
Q: The output from the following code is: #define max (a,b) ((a)> (b) ? (a) : (b)) int n, i=5, j=7; n=…
A: Initially the value of i = 5 and j = 7. then under the max function the value will be max(5,7) which…
Q: Write a code which enables a user to input the coefficients of a quadratic q(x) = ax + bx + c and…
A: Matlab code: prompt = " Enter coefficient 'a' of quadratic equation"; a = input (prompt); prompt2 =…
Q: What is wrong with the following code segment.... Given the following function to determine if a…
A: Wrong with the given code which the function to determine if a number is odd or even
Q: Question 1: 1- Write a code that performs the following function: f(x,n) = xin-1+2/n/in+x - 5sin…
A: Task : Given the x and n values. The task is to evaluate the function.
Q: write an annulusmoment() function that accepts two double precision numbers as perameters?
A: A cylindrical rod with hollow center is known as annulus. To find annulus moment i.e. second moment…
Q: Write a C++ function that receives an unsigned integer and returns its binary value. The code should…
A: To write C++ program to print binary value for unsigned integer
Q: C++ Write a function that takes as input a positive integer n and returns the n-th harmonic number.…
A: Given: C++ Write a function that takes as input a positive integer n and returns the n-th harmonic…
Q: 8. Write a function which calculates the following expression for a given number of terms (N) and x,…
A: Expressions are evaluated by using loop statements and built-in functions such as pow(). And also…
Q: n an integer n as input, print smallest number x such that x >= n and x is a palindrome. You have…
A: Lets see the solution.
Q: The right shift operation is similar to floor division by powers of two. Sample calculation using…
A: Algorithm - Take input from user. Now use the below logic - if not y: return x//1 return…
Q: The following function is written incorrectly: int factorial (int n) { if (n == 0) return 1; return…
A: To find the result of calling a given function with large integer.
Q: write program using function to count and print even positive number * ? C++
A: #include <iostream>using namespace std;void ce(int a[],int n){int c=0;cout<<"Even number…
Q: Suppose we have the function g (n) = 6n + 5n2 + 3n3. Below are a number of statements regarding how…
A: Given Suppose we have the function: g (n) = 6n + 5n2 + 3n3 which of the above statements is…
Q: Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the…
A: Start define swap_values(user_val1 , user_val2 ) function in which there are two argument user_val1…
Q: Modify the below program that the input values representing fractions are stored with denominators…
A: [Java Code ] //Import the essential package import java.util.ArrayList; import…
Q: int f(int n) { if (n 9 10. What is the value of f2 (10)? a. 21
A: Please find the correct answers and corresponding source code in the following steps.
Q: Plot the following function f(x,y) = 1/16(x^2-L^2)(y^2-L^2) over x,y in [-L/2, L/2]. It is important…
A: # import numpy and matplotlib.pyplot import numpy as np import matplotlib.pyplot as plt # set L L…
Q: Suppose we have the function f(n) = (n+1)3. Below are a number of statements regarding how the…
A: We are given function f(n) = (n+1)3. And we are asked that how the feature grows depending on n for…
Q: What are the problems (if any) with the following functions? Fix them and find appropriate pre- and…
A: 1. In the first function, returning false when the the number is not even is the correct way.
Q: Based on the code segment below, fill in correct code line using call by reference. void func (__---…
A: code segment given is- void func(____________________){ total=x*y; }
Q: For the following code the equation 1. y 0 2. i n 3. While i 20 4. do y ai +x.y i fi- 1 5. What is…
A:
Q: Given the code: void b(int n) { if(n<2) { cout <<n<< " "; " 1. return; } b(n-2); cout <<n << " "; }…
A: Following are the complete code to the given question: #include <iostream>//header fileusing…
Q: Write and test the following min() function that returns the smallest of four given integers: int…
A: Here, Code instruction is given.
Q: Write a function Infix_to_Prefix that takes an arithmetic expression in Infix notation as a…
A: Given Write a function Infix_to_Prefix that takes an arithmetic expression in Infix notation as a…
Q: Write a function that raises an integer to a positive integer power. Call the function x_to_the_n()…
A: //here i am writing my c code #include<stdio.h>//header file#include<math.h>//header…
Q: Q3: ) A: Write a program to find the value of (C) from the following function C=exp- where -Ea, xb,…
A: First, we will define the two vectors, a and b. Then using for loop, we find the numerator and…
Q: Write a function named myFunction(x) who accepts an input integer x and returns an integer n, such…
A: EXPLANATION - Main function is created . Two variable are created p and x . Input from user is…
Q: Trace the following code and give the output int t = 2, r = 3, d; do { d = r * t; cout = 0);
A: The given program is Program: #include <iostream>using namespace std;int main(){ int t = 2,…
Q: The following function will correctly return true if its argument is an odd integer bool Isodd (int…
A: A number is odd when number%2==1 But in the given function, the condition is n/2==1
Q: What is wrong in the following function? def f(n):if :print(n, end = ' ')f(n / 10)f(1234567)
A: Given, Code snippet: def f(n):if :print(n, end = ' ')f(n / 10)f(1234567) The given code is written…
Q: Write a function that prints the following pattern of n lines. * *+* * * * *…
A: Here have to determine about code for print pattern given in problem statement.
Q: 02. Write program in C++, using function to finds the sum of the following series:- Sum= 3!/7+5!/11+…
A: Introduction: In this question, we are asked to write the C++ program to get the sum of the series.…
Q: Write a code which enables a user to input the coefficients of a quadratic q(x) = ax² + bx + c and…
A: Matlab code: prompt = " Enter coefficient 'a' of quadratic equation"; a = input (prompt); prompt2 =…
Q: b) Write a python function binary(n) which takes as an input an octal number and returns as an…
A: Binary representation for octal numbers: 0 => 000 1 => 001 2 => 010 3 => 011 4 =>…
Q: Test with this data: 58 65 68 74 59 45 41 58 60 67 65 78 82 88 91 92 90 93 87 80 78 79 72 68 61 59…
A: Required:
Q: 5. What is wrong with the following function and why? int *setup(int n){ int a(n): for(int i=0; i<n;…
A: The solution to the given problem is below.
Q: What is wrong with the following code segment... Given the following function to find the minimum of…
A: C ++ code to find the minimum of two number
Q: 5. Write a function harmonic that will take an integer n as a parameter and return the result of the…
A: In this question, we are asked to write a program which return a sum of harmonic function Note:…
Q: Write a program that will read the value of integer x and evaluate the following function:
A: Input value of x If x>0, assign y=1 If x=0, assign y=0 If x<0, assign y=-1 Print y
Q: Given the following function: void printElement(int arr[], int count) { for (int i = 0, i < count;…
A: The answer is
Q: Q2/ what is the output of each iteration of y in the following code for (int y-10;y>0;y--)
A: Here the loop will run from y=10 and in every iteration value of y decreases by 1. continue…
Q: Re-write the following function so that a given XAND return the value of f(x).
A: logical error:- brackets were missing. as per the priority, *, / has same priority and…
This is a c
Step by step
Solved in 2 steps with 1 images
- Can someone pls explain to me ASAP??!!! In mathematics, the harmonic series is the sum of 1/1 + 1/2 + 1/3 + 1/4 .... Write a function harmonic that takes an argument n and calculates the sum of the series to n. Make sure to use lazy evaluation.(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 ≥ 3I need to organize the functions according to how fast they grow from the one that grows the slowest (top) to the one that grows the fastest. This is with regards to the O notation in Java Programming 100, n+1, 2log(n), n*ln(n), 2n^2, 2^(n+1), (2n)^n, 2n!, 5n^3, n*3^n.
- Code in Python Write a function, print_integers_less_than(n), which takes an integer parameter n and prints each integer k which is at least 0 and is less than n, in ascending order. Hint: use a simple for loop. For example: Test Result print_integers_less_than(2) 0 1 print_integers_less_than(5) 0 1 2 3 4 print_integers_less_than(-3)Write a program using function to check if the number is even or odd?Write a program to return the product of digits of given number.Write a program to find the sum of given 2 numbers.Write a program to find the max of two given numbers.Write a short Python function that takes a positive integer n and returns the sum of the squares of all the positive integers smaller than n. (i need the output also)
- What will be the space complexity of the following function?public static double test (int n){double x;if (n == 0) return 1.0;else{x = 0.0;for (int i = 0; i < n; i++)x += test(i);return x;}}A. O(1)B. O(n)C. O(2^n)D. O(n!)what could go wrong with the function show on the right? (tip: syntax error is not the answer) void goo(unsigned int n) { if (n==0) return; cout << n; goo(n-2); }Write a code which will take input as 2 numbers (INT first, INT second) and print 4 outputs (add, subtract, multiply, divide) applying following functions: a = first + second; s= first - second; m= first * second; d = first / second;
- Please solve the question by using MATHEMATICA, Write a function to randomly mix up the characters in a word. For example, if the input is "homework", you might output "eoomkwhr" or "wrhomoke". Your function should work on any input length, and all of the input letters must appear in the output.Write a Python function round_up that, given an integer, rounds it up the next multiple of 100. If the given number is already a multiple of 100, it is just returned. For example, round_up(234) returns 300 round_up(465) returns 500 round_up(400) returns 400 The round_up function does not read input or print output.Use Python Write a function, print_integers_less_than(n), which takes an integer parameter n and prints each integer k which is at least 0 and is less than n, in ascending order. Hint: use a simple for loop. For example: Test Result print_integers_less_than(2) 0 1 print_integers_less_than(5) 0 1 2 3 4 print_integers_less_than(-3)