Exercise 2: Write a program to find: Y= (x^2+x)/2, Where the limits of x from 0 to 10.
Q: I need help with this problem. Please help me, because I do not understand. if 14 > 7:…
A: In Python, indentation refers to the spaces at the beginning of a code line. In other programming…
Q: Write a program that reads in three integers and then determines and prints the largest and the…
A: Program approach:- Using the necessary header file. Display 3 inputs with the largest input…
Q: Code in Python Write a function, print_integers_less_than(n), which takes an integer parameter n…
A: Python : Python is a high-level and object-oriented programming language. it is used for web…
Q: program c Write a function that will calculate the sum of all the numbers multiple of 3 from 1 to…
A: Algorithm: Start Implement computeTotal() method which takes a number num as argument Inside the…
Q: 2) A BMI Calculator: the body mass index (BMI) is a measure used to determine whether a person is…
A: Java Code import java.util.Scanner; public class Test { public static void main(String[] args) {…
Q: Consider this code: "int s = 20; int t = s++ + --s;". What are the values of s and t? A. s is 19…
A: please upvote for my efforts thanks! answer: s++ is post increment --s in pre decrement as post…
Q: Following is the formula for calculating the mean or average of a set of values: X_mean =…
A: First, we will input the value of n. Then we will ask the user to input all the "n" numbers. We will…
Q: C++ Coding - Loops Party shop sells birthday gift bags in two ways. Customers can purchase a set…
A: code :-- // for setprecision and standerd input nad output #include<bits/stdc++.h>#include…
Q: This is python programming Create a function based on the following information: You are given…
A: Program Approach : Define function A. Declare string s1 and s2. Split string s1 and s2 . Perform…
Q: Find an incorrect line in the following code segment: void swap(int *x, int *y) { int t = *x;…
A: When we call a function in the main method in pointers we use: swap(&a, &b) , which will…
Q: projectile problem. As input, the function will take the initial height (y0) from which the…
A: Introduction: In this question it is asked to calculate the time of flight for a projectile with…
Q: Python Programming- Computer-Assisted Instruction Part 1: Computer-Assisted Instruction (CAI)…
A: Hey, since there are multiple part questions posted, we will answer the first part question. If you…
Q: This program is meant to help you get practice with writing programs to perform more complex…
A: #calculates the dotproduct of two vectorsdef dotproduct(v1,v2): sum = 0; for i,j in zip(v1,v2):…
Q: Write a program that recursively and iteratively counts down from n. a) Create a void recursive…
A: Since the programming language is not mentioned, we'll do it in c++ a) The programming methodology…
Q: Write a recursive function that computes the product of the digits in an integer. Use the following…
A: Repeated function call is known as recursion. Basically in recursion a function call itself again…
Q: ii. Add a function named count_all() to this program that takes two parameters, a list of…
A: THE ALGORITHM OF THE CODE:- 1. Define a function that takes two arguments, x and y. 2. Initialize a…
Q: A game calculates the average game scores for their players in three attempts. The score in the game…
A: here have to use void function with parameter. i have use attempt as parameter.
Q: Exercise 3: Write a function fact (n) which returns the factorial of n (n!). Note: n! is undefined…
A: Algorithm Function factorial return type is long long as the factorial of larger numbers can exceed…
Q: Task 06: Use the recursive definition of Fibonacci series and write a function int fib(int n) that…
A: ALGORITHM:- 1. Take input for the value of n from the user. 2. Pass it to the fib() function. 3.…
Q: Write a program that either: 1. Reads 10 integers from the user, or 2. Generates 10 integers between…
A: since you have not mentioned programming language I'm doing this in python
Q: Complete the code that returns the value of f(x), which has the value 1 inside the range –1 < x <1…
A: The complete code for the given problem is: def function_f(x): if x in (-1,1): fval=1…
Q: Write a C++ program that simulates online shopping. Declare a variable cart to be an empty…
A: I give the code in C++ along with output and code screenshots.
Q: Write a program that allows the user to enter a number between 1 and 1000. If the number is…
A: import math def isPrime(n): if (n <= 1): return False if (n <= 3): return…
Q: ISP- Java Write a program that will output a right triangle based on user specified input height…
A: CODE:- import java.util.*; class Main{ public static void main(String args[]) { int i,j,rows;…
Q: What does the function return for any positive values of x and n ? The answer should be a general…
A: #include <iostream>using namespace std; int what_do_I_do(int x, int n){ if (n == 1)…
Q: se C++ programming Language write a recursive function program that prompts the user to enter…
A: #include <iostream>using namespace std;void pattern(int lines);int main(){ int lines; cout…
Q: CodeWorkout X265: Recursion PIogramming Exercise:
A: Lets see the solution.
Q: Do in GO programming language A. Write a program in Go that uses a for loop to print the numbers…
A: The task requires writing three programs in the Go programming language: A. Write a program that…
Q: Your math teacher has asked you to write a program that grades the multiple-choice questions in a…
A: Algorithm: Create a list called "correctAnswers" containing the correct answers to the math exam.…
Q: The program below stores 80 bool values into a char arr[10]. Complete setBool and getBool. In both…
A: Actually, array is a collection of elements.
Q: In this lab, you will write a MIPS program to convert Fahrenheit temperature to Celsius. A basic…
A: Explanation: The program first prompts the user for input of a Fahrenheit temperature reads it in as…
Q: Write a function: • diceSim(D1,D2,trials) that takes as input the number of sides on die 1 (01) and…
A: diceSim(D1,D2,trials) that takes as input the number of sides on die 1 (D1) and die2 (D2) and the…
Q: This program should compound interest continuously. It asks the user for the number of times they…
A: Corrections made: Remove the list n and use a single loop instead of two. Use 2**i to get the year…
Q: The use ofcomputers in education is referred to as computer-assisted instruction (CAI). Write a…
A: #include <iostream>using namespace std;int ResultChecking(int a, int b){ while(true)…
Q: Write a program function that will find and add two digits odd numbers and subtract four digits odd…
A: Here, Code instruction is given.
Q: Exercise III: Catalan numbers For n e N, denote by c, to be the number of ways to form a "mountain…
A: Answer: Our guidelines is answer the first three question from the first question. I have given…
Q: Code in Python Write a function, print_perfect_cubes(n), that takes an integer parameter n and…
A: According to the information given:- We have to follow the instruction in order to get desired…
Q: In C++ write a program that generates three random numbers and then find the min number among the…
A: void getrandnum(int &n1, int &n2, int &n3) { srand(time(0)); n1 = rand(); n2 = rand();…
Q: Write a program that reads text from the user and reverses the order of every number that appears in…
A: Solution:-- 1)The given question has required for the solution to be provided with the help of the…
Q: In python This assignment assess problem solving ability and the use of the modulo operator,…
A: Python codeCode screenshotOutput screenshot
Q: Write a python program with the following functions: 1. the function factorial_loop(num) that takes…
A: Ans 1: Code: def factorial_recursive(num): if num == 0: return 1 return num…
Step by step
Solved in 3 steps with 1 images
- Task 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.language: Python Problem: Write a recursive function to add a positive integer b to another number a, add(a, b), where only the unit 1 can be added, For example add(5, 9) will return 14. When creating the function, also create a test case to prove the program works. The pseudocode is: # Base case: if b is 1, you can just return a + 1# General case: otherwise, return the sum of 1 and what is returned by adding a and b - 1Write a simple nested loop example that sums the even and odd numbers between 5 and 15 and prints out the computation. Write a for loop with a range function for even numbers. Write a for loop with a range function for odd numbers. Use a variable called calc to calculate the sum of even and odd numbers. Print the computation of each even number plus the odd number equal to calc to the terminal.
- Write 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 resultIn C language please: Write a function called printprime that takes the parameter N that prints all the prime numbers from 1 to N.Transient PopulationPopulations are affected by the birth and death rate, as well as the number of people who move in and out each year. The birth rate is the percentage increase of the population due to births and the death rate is the percentage decrease of the population due to deaths. Write a program that displays the size of a population for any number of years. The program should ask for the following data: The starting size of a population P The annual birth rate (as a percentage of the population expressed as a fraction in decimal form)B The annual death rate (as a percentage of the population expressed as a fraction in decimal form)D The average annual number of people who have arrived A The average annual number of people who have moved away M The number of years to display nYears Write a function that calculates the size of the population after a year. To calculate the new population after one year, this function should use the formulaN = P + BP - DP + A - Mwhere N is the…
- 6. You are given the following function that will calculate the sum of the first n numbers where n is an argument to the function. When n is 10, it should print out 55, but instead it prints out 10. Find and fix the problem. int findsum (int n) { int sum = 0; for (int i=1; iYou are given 2 out of 3 angles in a triangle, in degrees. Write a function that classifies the missing angle as either "acute", "right", or "obtuse"based on its degrees. An acute angle is less than 90 degrees. A right angle is exactly 90 degrees. An obtuse angle is greater than 90 degrees (but less than 180 degrees). Example: missing_angle(27, 59) → obtuse WRITE IN PYTHON PLEASE38. The geometric mean g of n numbers x; is defined as the nth root of the product of x;: g=Vx1x2X3•…Xn (This is useful, for example, in finding the average rate of return for an investment which is something you'd do in engineering economics). If an investment returns 15% the first year, 50% the second, and 30% the third year, the average rate of return would be (1.15*1.50*1.30)") Compute this.