A student is tracing the following algorithm. The function INT gives the integer part of any number, eg INT(2.3) = 2 and INT (6.7) = 6. Line 10 Input A, B Line 20 Let C = INT(A ÷ B) Line 30 Let D = B × C Line 40 Let E = A – D Line 50 If E = 0 then go to line 90 Line 60 Let A = B Line 70 Let B = E Line 80 Go to line 20 Line 90 Print B Line 100 Stop Trace the algorithm in the case where the input values are: (a) (i) A = 36 and B = 16; (ii) A = 11 and B = 7. (b) State the purpose of the algorithm.
Q: Assume that: P(x) means: x is a person; T(y) means: y is a time F(x, y) means: you can fool x at…
A: Conversion of predicate to english
Q: that prints out a flood map, showing which of the points in the terrain would be flooded if the…
A: floodMap method:- public static void floodMap(float[][] heights,float waterLevel){…
Q: he smallest positive integer which divides the expression (n+1)(n+2)(n+3)(n+4) is
A: The correct answer is given below:-
Q: Given a chess board, your job is to write a program that takes two squares x and y as input and then…
A: Code: #include <bits/stdc++.h> using namespace std; int dx[8]={-2, -2, -1, -1, 1, 1, 2,…
Q: Given a set of cities, the central point is the city that has the shortest total distance to all…
A: As programming language is not given in the question, attempting the question in java language.
Q: write a program to implement an genetic algorithm that targets a number n (where n will be user…
A: The Python program to solve the given problem is below.
Q: Give English language translations of the following wffs if L(x, y): x loves y H(x): x is handsome…
A: a. H(j) ∧ L(k,j) John is handsome and Kathy loves John.
Q: A collection of 26 English letters, a-z, is mixed in a jar. Two letters are drawn at random, one…
A:
Q: Write a computer program to compute the final value of A ,B AND F with keep the same arrangement.…
A: The answer is given below :
Q: Give English language translations of the following wffs if M(x): x is a man W(x): x is a woman i:…
A: 1. There exist a woman for whom all men work. 2. All men who work, work for women 3. All men for…
Q: What is the value stored in y when the algorithm below is used on the input: 3, 2, 1, 0? proc noname…
A: The given code is a procedure in which an array of elements of size n. The array, consisting of 4…
Q: Write a program that reads an integer and determines and prints whetherit’s odd or even. [Hint: Use…
A: C++ Program for above : #include <iostream> using namespace std; int main() { //read…
Q: I=I+1 C=B-A D= C**2+1.0E-2 I=3 F=(1.0+D)**(I-1) A=A+B+F
A: public class Calculate { public static void main(String args[]) { double a = 2.5;int i =…
Q: Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's…
A: Given: Write a program that takes in a positive integer as input, and outputs a string of 1's and…
Q: int RFunc(int a, int b) { if (a <= 0 || b <= 0) { return a+b; } else { return RFunc (a-1, b-1) +…
A: HERE IS STEP BY COMPLETE SOLUTION REGARDING YOUR PROBLEM
Q: Construct a Fibonacci number pattern that involves square roots. Both sides of the equation should…
A: We can implement this program in any language. Since the language is not mentioned here I will write…
Q: Write a program that finds summation of all factors of a given number r. For example, the factors of…
A: Algorithm:- for(int i=1;i<=n;i++) { if(n%i==0) sum=sum+i; }…
Q: Write a program that simulates flipping a coin to make decisions. The input is how many decisions…
A: The solution for he above given question is given below:
Q: Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's…
A: Program to enter the decimal number as Input and gives a binary string as output.
Q: Given int x = 6; double y = 3.14159265358979; String s = "pi"; which of the following generates…
A: a. s + " ".repeat(Math.max(4-s.length(),0)) + " = " + (int)y;
Q: Given a chess board, your job is to write a program that takes two squares x and y as input and then…
A: /* We can solve this problem using BFS*/ #include <bits/stdc++.h> using namespace std; int…
Q: Given a non-negative int n, return the count of the occurrences of 7 as a digit, so for example 717…
A: the program is given below:-
Q: Write a program in javascript to find the sum of 2 given variables. If the variables are equal then…
A: Required:- Please find the code below with the output.
Q: Jojo, Lili and Bibi are playing together. Because they had just learned the alphabet, Jojo also…
A: The, given information is: Jojo, Lili and Bibi are playing together. Because they had just learned…
Q: Write a program to plot x= y , x go to -15 to 65 with increments of 15 And then tis radius of circle…
A: Requirements :-
Q: Find the Big-Oh of the following. Explain your answer. 1- 1 for (int a : arra) ( 2 print (a); 5 for…
A: Big-oh notation is used to represent upper bound of an algorithm. It is denoted by O()
Q: Write a program that accepts a positive integer n. The program should output a cascading triangular…
A: I give the flowchart along with code and output screenshot in C
Q: For the alphabet (a, b) the regular expression (aa)*(bb)*b denotes Set of strings with 2 a's…
A:
Q: Given a chess board, your job is to write a program that takes two squares x and y as input and then…
A: Program: #include <bits/stdc++.h> using namespace std; int dx[8]={-2, -2, -1, -1, 1, 1, 2,…
Q: Given a chess board, your job is to write a program that takes two squares x and y as input and then…
A: In this, the technique of BFS is used. Breadth First Search (BFS) - This algorithm traverses a graph…
Q: Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's…
A: Programming logic step by step: First, take input from the user.Then, call the function…
Q: Consider that we have the string presented below, a quote from Thomas Edison, and we to extract and…
A: x=x.strip() x=x.split('.') Print(x[1]) Explanation This is the correct answer because strip…
Q: With a fancy calculator, finding square roots is easy. But what if you only had a basic…
A: Algorithm: The algorithm is a step by step process, defining a series of directions to be carried…
Q: Write a program to plot x= y , x go to -15 to 65 with increments of 15 And then t is radius of…
A: REQUIREMENTS :- APPROACH :- STRAIGHT FORWARDED QUESTION . PLEASE SEE MALTLAB CODE WITH OUTPUT AND…
Q: Perform a descriptive algorithm for the process of buying clothes in a warehouse where there is a…
A: customize DTP clothing : Altered DTP clothing administration is drawing a lot of consideration, and…
Q: Write an algorithm that reads radius (r) of a circle from the user and then print the area (A) and…
A: The steps or procedures or instructions that are performed in a definite order to obtained the…
Q: where m is the slope of the line and b is the y-intercept. Prompt user to enter the slope and…
A: Here is code of perpendicular.py import matplotlib.pyplot as pltimport numpy as np #taking x values…
Q: Write a program that takes in a positive integer as input, and outputs a string of 1's and O's…
A: Sample Response: #get input from userx= int(input())#As long as x is greater than 0while(x > 0):…
Q: Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's…
A: Since programming language is not specified, we will be answering this question in python.
Q: Consider the following program. if(N1 == R* || N2 =='r' ) cout<<"Red"; else if(N1 == 's' | N2 ==…
A: Since value of N2 is r and s hence The condition for Logical OR operator is being satisfied.
Q: using python Construct an experiment to determine what percentage of attempts will be pairs, when…
A: The python program to compute the matching of pairs of a 1000 attempts is given below with self…
Q: Write a program to solve tumor growth that can be modeled by the following equation over time :0 ≤t≤…
A: According to the information given:- we have to write a program to solve tumor growth that can be…
Q: Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's…
A: The while loop is used to iterate a part of the program repeatedly until the specified Boolean…
Q: Given the following function: boolean test (String str){ int count a-0; char e; for (int…
A: Answer Part a The above code has 3 conditions to return true 1. Last string symbol must not be 'a'…
Q: Write a program that asks the user for two integers; assume the second integer is larger than the…
A: In the solution of given problem, we need to read two integer numbers say integer1 and integer2,…
Q: Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's…
A: Define header files <iostream> and <string> for i/o and string operations. Use namespace…
Q: Implement a program that reads two integers (n and k). The program must output the binomial…
A:
solve the question(b)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- The population is modeled by P(t)= 19 72 73 000/ 1+ e^-0.03134(t-1913.25) t = date in years. Write a program and display the population every ten years from 1790 to 2000. Plot graph of population against timeWrite an algorithm for a program that determines all composite numbers between 1 and 20.A robot is placed at the origin of a 2D coordinate plane (i.e. position (0, 0)). The robot is given a string Scontaining N characters in {N, E, S, W} as its instructions. For each character from the beginning of the string,the robot has to move 1 unit to the following direction:• If the character is N, the robot has to move 1 unit to the positive y-axis direction.• If the character is E, the robot has to move 1 unit to the positive x-axis direction.• If the character is S, the robot has to move 1 unit to the negative y-axis direction.• If the character is W, the robot has to move 1 unit to the negative x-axis direction.You do not know the string S. However, you know another string P that is an anagram of S (i.e. P has thesame number of N, E, S, W characters as S). You also have M data points: T1...M, X1...M, and Y1...M. For alli, you know that the robot is at position (Xi, Yi) after moving exactly Ti units.You want to know the number of possible string S that satisfies all the…
- In city street grids, intersections are often defined by two integers, counting the position of horizontal and vertical streets (sometimes called streets and avenues). Imagine traveling from position (h1, v1) to (h2, v2). How many blocks do you traverse?with T=4, n=12 and A=(3,5,8,8,9,16,29,41,50,63,64,67). Draw the corresponding walkthrough as shownWrite an algorithm CH to subtract two numbers and show the result. ¢ Test your algorithm using values. Grade Given an integer mark, which is the marks scored by a student (out of 100) in a subject, the task is to assign a grade to the student. The grade is found out by mark >= 95 A+ 94- 90 89- 85 B+ 84-80 B 79 -75 C+ 74-70 69-65 D+ 64-60 D less than 60 F
- Let A = {a, b, c} and B = {u, v}. Write a. A × B b. B × AUsing Matlab. Monte Carlo methods are a class of computational methods that rely on repeated random sampling to compute their results. In this problem, you will use the Monte Carlo method to estimate the temperature at an arbitrary point in a uniform solid. Specifically, we will consider the solid object shown below. The temperatures of all surfaces are 500 des F with the exception of the two shaded surfaces, which are at 0 deg F. Inputs to the program should be: 1. The number of random walkers. 2. The (x,,2) coordinates of the point at which the temperature is to be estimated. 3. Plot interval (eg., you may want 1,000,000 random walkers in the simulation but may want to plot after every 10,000). Output from the program should be: 1. A graph of the estimated temperature, plotted according to the plot interval 2. Numerical value of the estimated temperature. USING MATLABWrite a program that will:• Select a random number between 1 and 100.• Test if the number is prime• Call a function named isPrime(). Pass the number to be tested. isPrime() should test whetherthe number has any factors other than 1 and itself. isPrime() returns either True or False.• isPrime() should use a function isDivisible(x,y) to test if y divides evenly into x. That is,isDivisible() will identify whether y is a factor of x.• Print the result
- Your team was asked to program a self-driving car that reaches its destination with minimum travel time. Write an algorithm for this car to choose from two possible road trips. You will calculate the travel time of each trip based on the car current speed and the distance to the target destination. Assume that both distances and car speed are given. Answer:Rolling a single six-sided die produces a random number between 1 and 6 with a uniform distribution. Rolling two dice produces a number between 2 and 12 with a binomial distribution. In this lab you will simulate a number of dice rolls and graph the number of occurrences of each value. 1) Create a function called rollDie() that takes no parameters, and returns a random value between 1 and 6. Do not seed the random number generator in this function. int rollDie() 2) Create a function called initArray() that takes a data array and the size of the array as parameters and fills each element with the summed results of rolling two dice. Do not assume that the data array has been initialized. void initArray(int data[], int size) 3) Create a function called sortArray() that takes an array and the size of the array as parameters, and sorts the array using the sediment sort. void sortArray(int data[], int size) The sediment sort works as follows: start with the second element in the array if…Program a simplified Galton board in python. It is required that: The user must select the number of rows n of the board The distribution resulting from dropping the beads should be displayed on the screen. Display an animation where the number of rows n increases over time.All resulting distributions must be scaled to the interval [0, 1], so that it is possible toappreciate the convergence to the normal distribution. Consider n from 1 to 80.