1. area_of_equilateral_triangle An equilateral triangle is a triangle whose sides are all the same length, so all of its internal angles are 60 degrees. Write a function to compute its area, given the length of a side, a. Recall (or look up) that the formula for the area of an equilateral triangle is (V3 / 4) * a? Sample calls should look like: >>> area_of_equilateral_triangle (10) 43.30127018922193 >> area_of_equilateral_triangle(2.5) 2.7063293868263707
Q: How do repeat the cents value? For example if I use the argument cents(1234), it should print 4321…
A: Program Instructions:In the function reverse_int(), take a string variable word, and use it to…
Q: (Wattan Corporation) is an Internet service provider that charges customers a flat rate of $7.99 for…
A: Hey there, I am writing the required solution based on the above given question. Please do find the…
Q: 1. There is a field with a shape of a rectangle. Trees will be planted to all sides of this field.…
A: Read the values for length and breadth of the field. Now find the number of trees that are planted…
Q: New York is 11 hours behind Bangkok. You will write a function nycHour (bkkHour: int) -> str that…
A: A 24-hour format time ca be converted to 12-hour format by subtracting 12 from 24-hour time when…
Q: Question 8: Write a function that takes a number and returns the largest digit value in the number.…
A: GIVEN: Create a python program that returns the largest digit in a number. SAMPLE INPUT AND…
Q: Write a function named hypotenuse() that accepts the lengths of two sides of a right triangle as the…
A: Input two sides a and b Calculate the other side c Print the other side
Q: The caret^, when found at the start of a character set, is the equivalent to "not" in RegEx. The…
A: Algorithm - Take input from user. Now use the below logic - lst = re.findall(pattern, txt)Display…
Q: ngineers often measure the ratio of two power measurements in decibels, or dB, which can be…
A: Declare variables required to hold the values for the power ratio expression. Declare the variables…
Q: In physics, an object that is in motion is said to have kinetic energy. The followingformula can be…
A: Given: In physics, an object that is in motion is said to have kinetic energy. The followingformula…
Q: Create a function that takes three arguments prob, prize, pay and returns true if prob * prize >…
A: In this problem, we need to design the javascript programming language. Input - three argument…
Q: (Wattan Corporation) is an Internet service provider that charges customers a flat rate of $7.99 for…
A: Hey there, I am writing the required solution based on the above given question. Please do find the…
Q: Question 5: Write a function that takes a string representing the binary representation of a number,…
A: Objective: This program includes a user-defined function to determine the decimal number from the…
Q: In this question: You are not allowed to use any of the functions from . Also, you are not allowed…
A: Below is the required C program: - Approach: - Include the header file. Declare the global…
Q: The first and second numbers in the Fibonacci sequence are both 1. After that, each subsequent…
A: function fib(number): Start declare i, n3, n2, n1 Initialize n3 =1, n2 =1, n1= 1 for i = 2 to…
Q: Big C , Enhanced eText .• E6.14 Write a function void bar_chart(double values], int size) that…
A: I cant figure out how to do the proportional thing you are asking, but I have coded up the basics,…
Q: Please write a function that computes the square root of an arbitrary positive number. The function…
A: As you have not mentioned, how to use the tol, iter_max and verbose, i have shown how to pass these…
Q: Define a function hypotenuse that calculates the hypotenuse of a right triangle when the other two…
A: Since you are not mentioning the programming language, we are using C++ to complete this program.…
Q: I have the whole thing almost done just need the area that says ":::::Need help here::::". Thank…
A: Code: #include <iostream>using namespace std; char getGrade( int score) // function returns a…
Q: You are creating a function that manipulates a number. The function has the following requirements:…
A: Suppose we have number like 2.35 or 3.78 Using the function described, the answer should be 2 or 4.…
Q: rite a function in_out (xs, ys, side) which takes three numbers as input, where the side is…
A: We need to define the function in_out() as given below :
Q: Create a function which returns the type of triangle, given the side lengths. Return the following…
A: As the programming language is not mentioned here, we are using PYTHON The code and output…
Q: Wattan Corporation) is an Internet service provider that charges customers a flat rate of $7.99 for…
A: #include<stdio.h> float round_money(float x) //function to round real number to 2 decimal…
Q: 7. A prime number is an integer greater than one that is only divisible by one and itself. Write a…
A: A prime number is a whole number greater than 1 whose only factors are 1 and itself.
Q: Create a function that takes three arguments prob, prize, pay and returns true if prob * prize >…
A: This C++ program has a user defined function with name profitableGamble().
Q: Given the codes below: int compute(int firstValue, int secondValue){ int result=0; result =…
A: EXPLANATION: The data type written before the name of the function prototype is the data type of…
Q: 1. There is a field with a shape of a rectangle. Trees will be planted to all sides of this field.…
A: Perimeter of rectangle with side1 and side2 is given as 2*(side1+side2) Perimeter will be the total…
Q: Find Relatively Prime Write a function to return a number that is relatively prime with the given…
A: Given number should be greater than 1 and less than n-1 A pair is said to relatively prime if both…
Q: The greatest common divisor (GCD) of two integers is the largest integer that evenly divides each of…
A: #note :since programming language is not specified we are providing answer in python #method to find…
Q: A company named ABC hired three employees in different years; each employee gets an increment of…
A: Program approach:- Using the necessary header file. Structure to store employee data. Char array to…
Q: Create a function that takes three arguments prob, prize, pay and returns true if prob* prize > pay;…
A: Algorithm - Design a method with 3 arguments as a number. Now use the below logic to solve the…
Q: Create a function called getHex() as follows: • This function should return a value of type char and…
A: A hexadecimal number is number whose base is 16. The permissible digits are 0, 1, 2, 3, 4, 5, 6, 7,…
Q: (Wattan Corporation) is an Internet service provider that charges customers a flat rate of $7.99 for…
A: The complete code is given below .
Q: Create a function which returns the type of triangle, given the side lengths. Return the following…
A: IN this problem we need to design the code in the RUBY programming language. Please find the logic…
Q: 4. Write a function named 'sum_fib3' which will take input int n and return the sum of the (n-1)th,…
A: As given, I need to write a C program having function called 'sum_fib3' that returns the sum of…
Q: Task 3 Write a function called foo_moo that takes a number as an argument and returns the following…
A: def foo_moo(n): # check if number is divisible by 2 and 3 return FooMoo if(n%2==0 and…
Q: Define a C++ function hypotenuse that calculates the hypotenuse of a right triangle when the other…
A: Since you are not mentioning the programming language. We are using C++ to complete this program.…
Q: Hi please Solve in c language. (Wattan Corporation) is an Internet service provider that charges…
A: Begin by creating the file usage.txt and save the data in it. Define header file <stdio.h>…
Q: Create a function that takes three arguments prob, prize, pay and returns true if prob * prize >…
A: In this problem, we need to design the javascript programming language. Input - two argument…
Q: JS You are writing a number guessing program where the player must try to guess the secret number…
A: the code is given below:
Q: Create a function that takes three arguments prob, prize, pay and returns true if prob * prize >…
A: We need to write a Javascript code for the given scenario.
Q: Write a C++ function named is Prime that takes a positive integer argument and returns true if the…
A: Here I have defined the function named isPrime(). Inside the function, I have used a loop to…
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: Engineers often measure the ratio of two power measurements in decibels, or dB, which can be…
A: We are providing answer for the third question alone since you haven't submitted the fourth…
Q: (python) Speed of Sound is a constant 343 m/s Create a function that will return the Frequency…
A: Algorithm of function calculate_frequency_heard(speed_of_sound, velocityR, velocityS, frequency): 1.…
Q: The caret, when found at the start of a character set, is the equivalent to "not" in RegEx. The…
A: In this problem, we need to design the code in the Python programming language. Input - String…
Q: Q 5: Returning -value Function (return.py) Give an example from your own, of a program that use a…
A: Actually, function is a group of statements.
Q: (Perfect Numbers) An integer number is said to be a perfect number if its factors, including1 (but…
A: Lets see the solution.
Q: Q2) Write a C function called SortTriple that has three integers parameters namely, low, mid, and…
A: The approach of the program is as follows: define the function sortTriple() that accepts 3 integer…
Step by step
Solved in 2 steps with 2 images
- (Numerical) Write a program that tests the effectiveness of the rand() library function. Start by initializing 10 counters to 0, and then generate a large number of pseudorandom integers between 0 and 9. Each time a 0 occurs, increment the variable you have designated as the zero counter; when a 1 occurs, increment the counter variable that’s keeping count of the 1s that occur; and so on. Finally, display the number of 0s, 1s, 2s, and so on that occurred and the percentage of the time they occurred.C++ A word is considered elfish if it contains the letters: e, l, and f in it, in any order. For example,we would say that the following words are elfish: whiteleaf, tasteful, unfriendly, and waffles,because they each contain those letters.Write a function called elfish that recursively checks, given a word, if that word is elfish or not.Write a function that takes in an integer n and computes n!. Do this without recursion. In [ ]: deffactorial_iter(n):"""Takes in an integer n>0 and returns the product of all integers from 1 to n."""# YOUR CODE HEREraiseNotImplementedError() In [ ]: In [ ]: assert factorial_iter(6) == 720 assert factorial_iter(7) == 5040 assert factorial_iter(10) == 3628800
- Write a function is ordered that takes an integer array and its size as parameters and returns true if the array elements are ordered in nondecreasing order and returns false if not. For example, integers in {10,0,1,1,5,1009} are ordered in nondecreasing order. On the other hand, integers in {1, 2, 3, 8, 4, 19} are not since 8 > 4Using C not (C++ or C#) Write a function int IsIncreasingOrder(int A[], int n) which will return 1 if A[i] < A[i+1] for i = 0 to n-2, otherwise it will return 0. Assume that elements are unique, i.e, no two elements have the same value.def find_root4(x, epsilon): ''' IN PYTHON Assume: x, epsilon are floating point numbers and epsilon > 0 Use bisection search to find the following root of x such that If x >=0, return y such that x - epsilon <= y ** 2 <= x + epsilon Else, return y such that x - epsilon <= y ** 7 <= x + epsilon Note: You must use bisection search to implement the function. ''' pass
- C. In permutations and combinations, the term “n C r” refers to n combinationstaken r at a time.??? =?!/?! (? − ?)!Write a recursive function to find the factorial of a number.Use the defined function to compute the term “nCr” for the following scenario:The values of ‘n’ and ‘r’ are stored in two parallel arrays of any user definedsize . You have to Read the arrays n and r at run time. Compute n C r for eachcorresponding terms in the array ‘n’ and ‘r’, and display it properly formatted.Also your program should print the current date and time using libraryfunctionsPYTHON!!! Write a function called number_matrix(r,c) that takes two parameters r and c and PRINTS ON THE SCREEN a matrix of numbers as follows: 1 2 3 4 5 .... 2 3 4 5 6 .... 3 4 5 6 7 .... . .. In this pattern, each row contains c numbers and there are r rows. For example, number_matrix(4,3) results in: 1 2 3 2 3 4 3 4 5 4 5 6 Note that you shouldn't be printing anything other than the required matrix of numbers. Even empty strings may invalidate your answer . """ def number_matrix(r,c):Write a function that accepts two arguments,, an array of integers, and a numberindicating the number of elements in the array. Th e function should recursive lycalculate the sum of all the numbers in the array. Demonstrate the use of the functionin a program that asks the user to enter an array of numbers and prints its sum.
- 3. Find Relatively Prime Write a function to return a number that is relatively prime with the given number. /* return an integer that is relatively prime with n, and greater than 1i.e., the gcd of the returned int and n is 1 Note: Although gcd(n,n-1)=1, we don't want to return n-1*/int RelativelyPrime (int n) 4. Find Inverse Then implement the following function, which returns the inverse modulo, and test it.Note that you need to check whether a and n are relative prime before calling thisfunction. Recall that a and n are relatively prime means that gcd(a,n)=1, i.e., theirgreatest common divisor is 1. Also recall that the extended Euclidean Algorithm canfind the integer s and t for a and n such that as+nt=gcd(a,n), where s is the inverseof a modulo n. /* n>1, a is nonnegative *//* a<=n *//* a and n are relative prime to each other *//* return s such that a*s mod n is 1 */int inverse (int a, int n){int s, t;int d = ExtednedEuclidAlgGCD (n, a, s, t);if (d==1){return (mod (t,…Write a function to find the maximum sum of a subarray within a given array of integers. The subarray should be contiguous, meaning the elements are adjacent to each other in the array. For example, given the array [-2, 1, -3, 4, -1, 2, 1, -5, 4], the maximum sum of a subarray is 6, which corresponds to the subarray [4, -1, 2, 1]. Write a function named maxSubarraySum that takes an array of integers as input and returns the maximum sum of a subarray. Note: If all the elements in the array are negative, the function should return 0. Example: Input: [-2, 1, -3, 4, -1, 2, 1, -5, 4] Output: 6 Input: [-1, -2, -3, -4] Output: 0 Write the maxSubarraySum function that solves this problem efficiently.Take a sorted array of 15 elements of type int and a value x from user, you need to find the ceilingand floor of x. The ceiling of x is the smallest element in array greater than or equal to x, and thefloor is the greatest element smaller than or equal to x. Assume than the array is sorted inascending order. Write a c++ program using functions to find floor and ceiling of x from the given array.Examples : For example, let the input array be {1, 2, 8, 10, 10, 12, 19}For x = 0: floor doesn't exist in array, ceil = 1For x = 1: floor = 1, ceil = 1For x = 5: floor = 2, ceil = 8For x = 20: floor = 19, ceil doesn't exist in array