Exercise 1: (Algorithms and Flowcharts) To calculate Volume of cube (volume= length * length * length)
Q: 6) What are the values of these sums, where S = {8, 10, 14, 20, 21, 24, 29}? %3D 2 a ) Σκes k b)…
A: 6) Given, S = { 8, 10, 14, 20, 21, 24, 29 } a) Σ k ∈ S k = 8 + 10 + 14 + 20 + 21 + 24 + 29 =…
Q: Q1) A vector is given by x = [7,19,2,14,5,12,4,18,6,13]. Using conditional statements and loops,…
A: The steps to create the program: Create a vector x to store the values. Declare the vectors T and…
Q: Python code Write a function that, given two integers, return the product of every integer between…
A: As per our guidelines we are suppose to answer only first question. Kindly repost other question…
Q: Q2) Write a function that returns the sum of n numbers using: n is entered from user. (a) Recursive…
A: //Function to find the sum of n numbers using a recursive approach int ReSum(int n) { if (n…
Q: mperature T to be 3 T •Op/T x*e* Cy = 9Vpk | dx, (ex – 1)2 - nere V is the volume of the solid, p is…
A: CODE: import mathfrom scipy import integrateimport matplotlib.pyplot as pltdef cV(T):V = 0.001 #…
Q: You are planning an outing with some friends and need to calculate the total price of the tickets. A…
A: Given data, Write a program in a file named tickets.py Some of the friends planning an outing and…
Q: - A Moving to another question will save this response. Question 9 Given the function F(X,Y,Z)=XZ +…
A: In this question, we have to simplify the given function F. Using boolean properties, we can…
Q: 7. s] A transport consultant has created a file of information about trips collected from…
A: - We need to have the flowchart for the devised algorithm.
Q: Q12) Consider you have a 4 x 5 matrix, matrix values are randomly generated between 0 and 1. Use…
A: #include <stdio.h>#include <stdlib.h> int main(){ int i, j, rows, columns, largest,…
Q: What is the number of execution times of the following program?
A: What is the number of execution times of the following program? label1: MVI B, O INR A loop label1…
Q: CodeWorkout Gym Course Search exercises... Q Search kol X459: Review Fibonacci In mathematics, the…
A: Given: To write a recursive function that returns nth fibonacci number:
Q: short answers : c)Give an example of a common floating point arithmetic error due to the particular…
A: an example of a common floating-point arithmetic error due to the particular way in which…
Q: Euler's totient function, also known as phi-function ϕ(n), counts the number of integers between 1…
A: 1. Start the function euler_totient(n) with the input parameter n.2. Initialize the variable…
Q: Read the following passage below. Then describe the 3 important ways spreadsheets can help you or a…
A: Given:-
Q: Function 5: Break Array _breakArray (array, n) Create a JavaScript function expression that meets…
A: java script function for the requirements BREAK ARRAY
Q: (Find the smallest n such that n^2 > 12,000) Use a while loop to find the smallest integer n such…
A: #program to find smallest integer n, such that n^2 greater then 12000n=100#starting with n=100,since…
Q: race these print statements using the following arrays. Write "error", if an error occurs.
A: The given problem is related to arrays in Java where the declaration of various arrays is given…
Q: 3 9 10 11 12 det verity(number): # do not change this line! # write your code here so that it…
A: Below is the code:
Q: 1) BFS refresher: Suppose you have an n × n chessboard and a knight placed in one of the squares.…
A: The objective is to carry out BFS beginning from the Knight's original position. From a given point…
Q: Problem E: Dice Game Looped Write a program that allows two users to play the dice game in Problem D…
A: Answer:
Q: Alert dont submit AI generated answer. (Central city) Given a set of cities, the central city is…
A: Since you are not mentioning the programming language, here we are using Java to complete the…
Q: Write pseudocode and program structure for the problem given below; () Problem: Reads in three…
A: START DECLARE num1, num2, num3 INPUT num1, num2, num3 IF num1 < num2 AND num1 < num3 IF num2…
Q: Write a program that calculates the time neccessary to completely fill an empty pool with water. We…
A: The algorithm of the code is as follows:- 1. Start2. Ask the user to input the pool dimension…
Q: Functions Exercise (Parking Charges) A parking garage charges a $2.00 minimum fee to park for one…
A: Source Code :-#include <iostream>#include <iomanip> using namespace std; /** * Creating…
Q: Question 19 (Algorithmic problem) Write a RECURSIVE function that, given a text (as a string),…
A: I have provided PYTHON CODE along with CODE SCREENSHOT and OUTPUT…
Q: . (True/False): A segment selector points to an entry in a segment descriptor table
A: The segment selector uses segment descriptor to point to the entry value in segment descriptor…
Q: Suppose we want to code the following function below. x2 f(x) = { 21x| – 1 |x|>1 |x| < 1 Write an…
A: Input : Value of x. Output : Value of f(x).
Q: 137 (base 10) = (base 4) (use subtraction method) Your Answer:
A: This question comes from Number Theory which is a part of COMPUTER SCIENCE. Let's discuss it in the…
Q: Programming Exercise 9. Ocean Levels Assuming the ocean's level is currently rising at about 1.6…
A: 1. Define constants: - annual_rise = 1.6 # millimeters per year - years = 252. Initialize…
Q: The following function has errors. Locate as many errors as you can. void area(int length = 30, int…
A: Correction Explanation: The argument length should be declared inside the function body or at the…
Q: Right rectangular pyramid Solve for surface area A = [w+lv 1 W Base width h Pyramid height Base…
A: Introduction A function in programming is a section of code that completes a particular task and may…
Q: 05) write algorithm and draw flowchart for the problem: Read two numbers and find subtraction two…
A: Algorithm: Step 1: Start. Step 2: Read two numbers from the user suppose x and y. Step 3: Perform…
Q: Net Salary Calculator (Toy Problem) Write a program whose major task is to calculate an individual’s…
A: Algorithm for Net Salary calculator- Take input as basic salary. Calculate the gross salary, HRA,…
Q: Display three patterns using loops) Use nested loops that display the following patterns in three…
A: #include<iostream> using namespace std; int main(){ cout<<"Pattern A"<<endl;…
Q: Q2) (Perfect Numbers) An integer number is said to be a perfect number if its factors, including 1…
A: **This program is written in PYTHON since no programming language was mentioned in the question.**…
Q: Sum: a recursive function that computes the sum of integers 1, 2, 3, …., n for a given number n.…
A: Let's first discuss about recursion. Recursion:- It is the process in which a function calls itself…
Q: Complete the code for this recursive function. def fib(n): if n == 1: return 0 if n == 2: return 1…
A: Introduction: - Here is asking to complete the code, that will need to fill in the two blank that…
Q: 1. A function's workspace shares the same workspace as the command window. 2. Given an m x n array…
A: the answer is an given below :
Q: Design a function that accepts an integer argument and returns the sum of all the integers from 1 up…
A: def SumOfNumbers(n): if n <= 1: return n return n + SumOfNumbers(n - 1) n =…
Exercise 1: (
- To calculate Volume of cube (volume= length * length * length)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
- Enter two numbers and find their least common multiple. -Use for -Do not use arrays or and or functionsExams.cpp) Suppose a teacher weights the fourexams he gives 10%, 25%, 30%, and 35%. Write a programthat reads ten sets of four grades, prints the weightedaverage of each set, and prints the unweighted average ofeach test. The number of students should be in a globalconstant.Modified coin-row problem:If we modified the coin-row problem, so that you cannot take the adjacent coin, and youcannot take the coin next to the adjacent coin also (see example below), what would thedynamic programming formula F(n) be?Example: A, B, C, D, E, F, G, H, I, JIf A is taken, then B & C cannot be taken, but D (or above D, like E and so on) can be taken.If B is taken, then A, C, D cannot be taken.And so on.
- a) Write a program that asks user to enter number of vertices in a directed graph and then the adjacency matrix representing the directed graph. The program, then, must display the node with the highest outdegree. Assume that nodes are named as 0, 1, 2 and so on. You will find a sample run of the program below. Enter number of vertices: 4 Enter adjacency matrix: 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 0 Node with the highest outdegree: 0Problem3: Looping: (30 points)Create a program flowchart that generates and displays the Fibonacci sequencenumbers of n(as input). In Fibonacci, the current third number is the sum of two previousnumbers. Sample input/output dialogue:Enter a no. 9Fibonacci series : 1 1 2 3 5 8 13 21 34Your flowchart and pseudocode here…...pls help me :(3. Do the followings, a. Create the following 3-by-3 matrix, [1 1 3] C = 54 9| l3 5 1] b. Using for loop print the summation of the all terms for each row, HINT: For the 1" row it must be 5 HINT: For the 2nd row it must be 18 c. Using for loop print the multiplication of the all terms for each row, HINT: For the 1" row it must be 3 HINT: For the 2nd row it must be 180 d. Modify your code, so that it can handle matrices with different sizes.
- Exercise 1: (Design of algorithm to find greatest common divisor) In mathematics, the greatest common divisor (gcd) of two or more integers is the largest positive integer that divides each of the integers. For example, the gcd of 8 and 12 is 4. Why? Divisors of 8 are 1, 2, 4, 8. Divisors of 12 are 1, 2, 4, 6, 12 Thus, the common divisors of 8 and 12 are 1, 2, 4. Out of these common divisors, the greatest one is 4. Therefore, the greatest common divisor (gcd) of 8 and 12 is 4. Write a programming code for a function FindGCD(m,n) that find the greatest common divisor. You can use any language of Java/C++/Python/Octave. Find GCD Algorithm: Step 1 Make an array to store common divisors of two integers m, n. Step 2 Check all the integers from 1 to minimun(m,n) whether they divide both m, n. If yes, add it to the array. Step 3 Return the maximum number in the array.Program to sort the array in descending order. (JAVA) + Enter size of array and then enter all the elements of that array. + Now use for loop and variable we sort the array in descending order.Python question Analysis: Invariants (Q16-17) For each of the following functions, identify the loop invariant, exit condition and post condition. Question 16 (Invariant 1) This function returns the list of integers that are multiples of both 3 and 7 that occurs within a given list. Identify the loop exit condition, the loop post-condition, and the loop invariant at the end of the loop, which shows the algorithm’s correctness. def multiples_count(lst): """ Input: a list of integers, lst Output: the list of integers in lst that are multiples of both 3 and 7 """ res = [] for i in range(len(lst)): if lst[i]%3 == 0 and lst[i]%7 == 0: res.append(lst[i]) # Identify the loop invariant here return res Question 17 (Invariant 2) This function checks if a given list (of comparable elements) is sorted in ascending order. Identify the loop exit condition, the loop post-condition, and the loop invariant at the end of each iteration of the loop, which…
- 7: Exams.cpp) Suppose a teacher weights the four exams he gives 10%, 25%, 30%, and 35%. Write a program that reads ten sets of four grades, prints the weighted average of each set, and prints the unweighted average of each test. The number of students should be in a global constant.1.)I have to recursive with python language and was asked to do a buy 2 get 1 free where you have some amount of money(x) each item costs a given amount(y), for each 2 item you get 1 free, builda recursive solution to find out how many items you can buy for x amount of money. 2.) Buy M, get N free Then alter your first answer to allow for the user to enter any M and N for how many you need to buy to get free items
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)