16. Write a program to print a table of values of n, log n, n², and 2" for n = 10, 20, . ,200. You do not need any functions other than main (). ...3
Q: Question 2: Write a program that defines a function, RoundToThousands(number), to round a number x…
A: Step 1:- Program Approach:- 1.Declare the user-defined function that function takes one parameter.…
Q: Decryption Key A|B|C| D|E|F|G|H|I|J|K|L|M N|O|P|Q|R|S|T|U|V|W|X|Y|Z (letter above equals below, and…
A: Hence, there is no programming language is mentioned I have solved your question using c++…
Q: The function doit(a,b,c,d) is a function that multiplies the smallest of its integers arguments by…
A: C Program: #include <stdio.h> //function prototypevoid doit(int,int,int,int); int main() {…
Q: 1 1 12. Write a function harmonic (n) to return the sum 1+ + + + (These 2 3 n sums are known as…
A: The code is : # a function harmonic(n) that returns the sum of the harmonic series: 1 + 1/2 + 1/3…
Q: Use Python You are planning to add bookcases to a wall in your living room, but you don't know how…
A: ALGORITHM:- 1. Create a function that takes 2 inputs first in feet and second in inches. 2.…
Q: 6. Write a program which reads string and rewrite it in alphabetical order. For example, the word…
A: Write a program which reads string and rewrite it in alphabetical order. For example, the word…
Q: What does the following function do? int fun(int x, int y) if (y == 0) return 0; return (x + fun(x,…
A: Lets dry run for x=2 and y=4 1.fun(2,4) y==4 So 2+fun(2,3)---------------------->2+6(returned by…
Q: Call a function to add 5+3. The function will show three variables but the calculation is done in…
A: Programming language is missing in the question. The below program is written in C, C++, and Python…
Q: Complete the function that calculates the sum of the first n+1 terms of the geometric series a, ar,…
A: I give the code in Python as per your requirement along with output and code screenshot
Q: A triangular number is defined as m(m + 1)/2 for m = 1, 2, c , and so on. Therefore, the first few…
A: #include <iostream>using namespace std;int getTriangularNumber(int m){ return m*(m+1)/2;}int…
Q: Need help writing a lisp function A function that generates a random day of the week, then displays…
A: The code is given below with output screenshot
Q: What is the value returned by the function? main(){ int x; x=func(4); }
A: Answer:
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: Write a simple calculator program with four operations: add, subtract, multiply, and divide. Create…
A: Required: Write a simple calculator program with four operations: add, subtract, multiply, and…
Q: Write a function that returns the average of the first N numbers, where N is a parameter.
A: The required function is shown below. //function to find and return the average of first N…
Q: 2) The ceiling of a floating-point number x is the smallest integer that is still larger than or…
A: Actually, python is a easiest programming language. It is a structural and object oriented…
Q: Write a function that adds two numbers. You should not use+ or any arithmetic operators.
A: Our first instinct in problems like these should be that we're going to have to work with bits. Why?…
Q: Jack and Jill are novice programmers. They are asked to write a function in C Language that…
A: Below is the given program: #include <stdio.h>int jack(int n, int i){ if(i<=9) {…
Q: Complete the function that calculates the sum of the first n+1 terms of the geometric series a, ar,…
A:
Q: # Continue this code by writing a function that will add the values of a l for a in range (1,3):…
A:
Q: Write a function number_name (N) that takes an integer (up to 1000) as argument N and returns the…
A: A required program is as follows, def number_name(N): # dictionary to store one digit and two…
Q: write a function that returns a value to main and identifies if an integer number is odd or even.…
A: According to the Question below the Complete Program: Program Output:
Q: NEED HELP WITH THIS import random print(random.randint(1,6)) #prints a number between 1 and 6. #or:…
A: import random#functiondef try_your_luck(dice1, dice2): #cases given in question #sum is >…
Q: Task 2: The formula for the area, A, of a triangle with sides of length a, b, and c is A = V[s(s –…
A: - We have to create the program for the are of the triangle problem. - We are using C++ here.
Q: 9. Write three functions that are the “inverses" of to_secs: (a) hours_in returns the whole integer…
A: def hours_in(s): h = s // (60 * 60) return h
Q: Cassette drive is the name given to a conventional cassette recorder used to store or load computer…
A: Cassette drive is a kind of tape recorder that may be used to store or load computer data.
Q: 6. You are given the following function that will calculate the sum of the first n numbers where n…
A: After correcting the code, I have provided C CODE along with CODE SCREENSHOT and OUTPUT…
Q: Q1. Write a program so that it asks for x and n values to calculates the sum of the following series…
A: We need to write a program for the given scenario. Language used is C++.
Q: Create a function that takes an integer and returns Trueif it's divisible by 100, otherwise return…
A: def division(n): if n%100 ==0: return True else: return…
Q: NOTE: Solve this as soon as possible, I need this urgently. (a). Write a function that takes an…
A: Code for the problem #include <iostream>using namespace std;bool checkprime(int num,bool…
Q: Write a function isPrime to test whether a number is prime or not. Use this function in main() to…
A: Note: ”As no specific programming language is mentioned in the question. So, i am using C++…
Step by step
Solved in 2 steps with 2 images
- The function doit(a,b,c,d) is a function that multiplies the smallest of its integers arguments by 2. If more than one arguments are equal and are the smallest, they are multiplied by 2. For example given a=5,b=3,c=7,d=9, doit (a,b,c,d) changes b to 6. Write the code of the function doit and test it.6. Write a program which reads string and rewrite it in alphabetical order. For example, the word STRING should be written as GINRST. 7. Write a program to replace a particular word by another word in a given string. For example the “PYTHON” should be replaced by “C” in the text “It is good to program in PYTHON language”. 8. Write a program that will find the maximum number from 3 float type numbers. You have to usethe function getMax which will take 3 pointer variables and return the maximum number.Please give me correct solution.
- please use pythonTask 2: The formula for the area, A, of a triangle with sides of length a, b, and c is V[s(s – a)(s – b)(s – c)] A = Where (a + b + c) s = Write, test, and execute a function that accepts the values of a, b, and c as parameters from a calling function, and then calculates the values of s and [s(s - a)(s - b)(s - c)]. If this quantity is positive, the function calculates A. If the quantity is negative, a, b, and c do not form a triangle, and the function should set A = -1. The value of A should be returned by the function. Test the function by passing various data to it and verifying the returned value.Create a function that validates whether a number n is within the bounds of lower and upper. Return false if n is not an integer. Examples intWithinBounds (3, 1, 9) → true intWithinBounds (6, 1, 6) → false intWithinBounds (4.5, 3, 8) → false
- write a function that returns a value to main and identifies if an integer number is odd or even. for example your function could be: int odd_even(int num) { if (num%2==0) return 0; .......please solve this in pythonWhat is the value returned by the function? main(){ int x; x=func(4); } int func(int x){ int y=1, m; for(m=1; m<=x; m++){ y* = m; } Select one: O a. 12 O b. 24 O c. 18 O d. 15
- Create a function that takes two integers, num and n, and returns an integer which is divisible by n and is the closest to num. If there are two numbers equidistant from num and divisible by n, select the larger one. Examples roundNumber (33, 25). - 25 roundNumber (46, 7)→ 49 roundNumber (133, 14) → 140Create a function that determines whether a number is Oddish or Evenish. A number is Oddish if the sum of all of its digits is odd, and a number is Evenish if the sum of all of its digits is even. If a number is Oddish, return "Oddish". Otherwise, return "Evenish" For example, oddishOr Evenish (121) should return "Evenish", since 1 + 2 + 1 = 4. oddishorEvenish (41) should return "Oddish", since 4 + 1 = 5. Examples oddishOr Evenish (43) → "Oddish" // 4 + 3 = 7 // 7 % 2 = 1 oddishorEvenish (373) // 3 + 7 + 3 = 13 // 13 % 2 = 1 → "Oddish" oddishOr Evenish (4433) → "Evenish" // 4 + 4 + 3 + 3 = 14 // 14 % 2 = 0Need help writing a lisp function A function that generates a random day of the week, then displays a message saying that "Today is ... and tomorrow will be ...". create a global variable before the function containing the days of the week as a list. Then use the built-in function random first to generate a number between 0 and 6 (including). The expression (random) by itself generates a random integer. You can call it with one parameter to return a value within the range from 0 to the value of the parameter-1. For example, (random 10) will return a value between 0 and 9. Next, use the number generated at the previous step to retrieve the symbol for the day of the week from the list. For that use the built-in elt. Here's an example of a call to elt which evaluates to 3: (elt '(1 2 3 4) 2) ; returns 3 We want the name of the day to appear capitalized. For this, extract the symbol-name of the day first, then apply the built-in function capitalize to it. Use the result in the princ…