Write a program in scala programming language to get the absolute difference between n and 21 and if n is greater than 21 return the triple the absolute difference.
Q: Write a python program for number of circular permutations of n different things taken all at a time…
A: Approach: It is the concept of Circular permutation i.e. there is no specific starting point in the…
Q: Write a Python program to calculate and print the number of positive and negative changes in a…
A: pos=0 neg=0 #read string from user s=input() #find nof negitives and positives for i in…
Q: Program sine_evalution_series implicit none Integer::n,m,k,i.j,f Real:: x,term,sum Read ",n,X Do…
A: Given code:
Q: Write a program to compute sin(x) for given x. The user should supply x and a positive integer n,…
A: This question comes from Programming Language which is a paper of Computer Science. Let's discuss it…
Q: Write a program in scala program to computer the sum of two given integers value. If the values are…
A: Please find the answer below
Q: Write a program in python to take a complex number from. User and calculate the true square root of…
A: Requirements :- Write a program in python to take a complex number from. User and calculate the true…
Q: Write a program to calculate the value (x + 1)! (x+ 2)!, (x+3)! (x+ 4)! (x + n)! s = 1+ 2! 4! 6! 8!…
A: PROGRAM CODE: #include <iostream> // include header file for input output…
Q: Write a C++ program that does the following: a. Compute the divided difference table for the…
A: Solution:-- 1)The question given is asking for the code of the C++ language for printing the…
Q: Write a python program that that chooses among two alternative unary operations on a real number…
A: The absolute value of a real number is defined as the value of the real number without any sign or…
Q: Write a python program that calculate the values of (X + Y) x (X – Y) where X, Y = 0, 1, 2, …, 9 and…
A: To solve the given problem, first we define a function compute(), with two arguments x and y, and…
Q: Write a F90 program to find the number of terms that are required to make (y = 0.4930687) of the…
A: The sin function in Fortran calculates sin of a radian value. To determine the radian value, the…
Q: Write a python program to accept 4 numbers x, y, p and q as input from user if x modulus p is equal…
A: required
Q: Write a program to find the sum of the first 50 terms in the series: x= 3+ (3+6) + (3+6+9) +…
A: Program Approach: Including the necessary header file Declaring the main method Declaring integer…
Q: Write program in c++ language that compute the following equation: 5x2+3 OsxS 100; Y= 0> x; 2x+x+1…
A: Here is the c++ program to compute the value of y for different range of x values
Q: Write a python program to print the sum of the first n terms of the following series: 1/2 – 1/4 +…
A: Sample Response: #Python program to find the sum of series (1/2)-(1/4)+(1/6)-(1/8)+..#function to…
Q: Write a C++ program to look for and print the first perfect square (x*x) when its last two digits…
A: Algorithm:- 1.) Start with initializing 1. 2.) loop over the while loop till its true. 3.) add the…
Q: Write a python program to accept 4 numbers X, y, p and q as input from user if x modulus p is equal…
A: Start Input x, y, p, q If x%p==1 then z=(p*x**3+q*y**5)/4 Else z=(p**4+q**4)/(x*x+y*y); Print z Stop
Q: Write a program in scala programming language to check which number is nearest to the value 100…
A: Given:
Q: Write a program in Scala programming language to check a given integers anx return true if it is…
A: Required:- Asap Please see the code below with the output.
Q: The function f(n)= n4.3+ n° log n + 10 is a. O(log n) O b.O(n5) O. o(n5 log n) O d. 0(n2.5) e. O(n…
A: Here in this question we have given a function and we have asked to find complexity in term of big…
Q: Given float x,y,z; int a,b,c; a=3;b=10;c=4; x=a+b/2+c*2; y=a-b/ (3+c) * (2-a); z=a+ ( (b/…
A: Code implemented in C program: #include <stdio.h> int main(){ float x, y, z; int a, b,…
Q: Write a Python program to read an integer value m and calculate the following mathematical series.…
A: #asking user for inputm=float(input("Enter value of m : "))Sp=0#this loop will run 10 timesfor i in…
Q: Write a program that calculates the root mean square value (rms) of the real numbers those will be…
A: sqrt() is used to find the square root of number available in cmath header section
Q: Create a simple Java Program to Compute Quotient and Remainder
A: / operator is used to find quotient and % operator is used to find remainder. / is division…
Q: Write a python program to find the remainder which is finded from the sum of odd numbers by sum of…
A: Algorithm: Take the value of n from user. Run a loop from zero to n. If i divided by 2 gives…
Q: Write a program to find the sum of the first n natural numbers, where thevalue of n is provided by…
A: Problem solution 1. Count the natural numbers that need to be added up and store the result in a…
Q: Write a program in the Fortran language to compute the value of y x3 x5 y = 1-3 ...n ... 5! 7!
A: In the solution of the given problem, to compute y for given x. The user should input the value of x…
Q: Write a program in C++ language to evaluate this equation: i? + cos j -jmod 3, if i 5 - y = i sin i…
A: The code with the comments is given below: #include <iostream>#include <math.h>using…
Q: 3.) Find the values of the following expressions in the computer language for a = -3, b = 8,c = 12,…
A: For use of pow(0 and sqrt() function we have to import #include<math.h> 1)Declare a, b, c, d,…
Q: Write a python program to accept 4 numbers x, y, p and q as input from user if x modulus p is equal…
A: #Taking input from userprint("Enter x: ")x = (int)(input()) print("Enter y: ")y = (int)(input())…
Q: Write a program to compute Z value from following series by using subroutine. (X-4)6 Z = 7! (X-6)8…
A: Sample Response: //C++ program to compute sum of series (X-4)^6/7! + (X-6)^8/9! + (X-8)^10/11! +…
Q: Write a program which takes in two 16 bit numbers and finds the total sum of all the numbers that…
A: The question is on write a program that finds total sum of all the numbers that are divisible by 4…
Q: Write a program in JAVA to find the sum of the series 1 +11 + 111 + 1111 + .. n terms. Sample…
A: import java.io.*;import java.util.*;class HelloWorld { static int summation(int n) { int sum = 0, j…
Q: Write a python program to print all prime numbers in a given interval.
A: Question. Write a python program to print all prime numbers in a given interval. Answer. A python…
Q: Write a java program to find the LCM of two user entered integer numbers.
A: Step 1 : Start Step 2 : Define a user defined recursive function named lcm to compute the LCM of two…
Q: Write a program to calculate the K value using if else condition If P value is more than 9 then K =…
A: Note: Answering the given question in python as no programming language is mentioned Input to the…
Q: Write a python program to accept 4 numbers x, y, p and q as input from user if x modulus p is equal…
A: Editable code: #Input x, y, p, qx=int(input())y=int(input())p=int(input())q=int(input()) # if-else…
Q: Write a Python program that takes a number as input from the user and outputs how many divisors the…
A: python code : n=int(input()) #taking input count=0 #variable for countining number of divisors for…
Q: Write a program in scala programming language to check whether two given positive integers have the…
A: As It is not declared in the program that the input should be taken from the user.
Q: Write a program that will help an elementary school student learn multiplication. Use the rand…
A: PROGRAM EXPLANATION: Include the header file. Define the main function. Set the srand with the…
Q: Write a program to compute the functions: Natural logarithms, integer value, and absolute value for…
A: Since no programming language is mentioned, I am using Matlab. Code: y=input('Enter y value:…
Q: Write a Python program to read an integer valuep and calculate the following mathematical series.…
A: In python programming we have various mathematical functions that we can use directly in our code by…
Q: Write a python program to accept 2 numbers P, Q as input from user if first number is even and…
A: P = int(input("Enter value of P: ")) # Asking for value of P from user Q = int(input("Enter value…
Q: Your task is to write a computer program that computes an approximation for e using the formula…
A: def factorial(num): mul = 1 for i in range(1, num+1): mul = mul * i return mul
Q: Write a Python program to get the geometric mean of n numbers. Take the n numbers from the user.
A: Required:- Write a Python program to get the geometric mean of n numbers.Take the n numbers from the…
Q: function y=LogTay(x,n,x0) %pre:x,x0,n %posty y=log(x0)3B term=1; E for k=1:n…
A: Task : Given the function in Matlab. The task is to find the function's output based on given…
Q: Write a program to compute S value from following series by using subroutine. (х-5)6 (X-7) (X-9)10 S…
A:
Q: Write a python program to solve the following series given below and explain the logic of the…
A: When using for loop we will run the for loop from i = 6 to i = n. The increment will be 2. And…
Q: Write a python program to accept 4 numbers x, y, p and q as input from user if x modulus p is equal…
A: Code: #declaring required variables reading user inputx=int(input("enter x: "))y=int(input("enter y:…
Step by step
Solved in 3 steps with 2 images
- (Program) Write a program that tests the effectiveness of the rand() library function. Start by initializing 10 counters, such as zerocount, onecount, twocount, and so forth, to 0. Then generate a large number of pseudorandom integers between 0 and 9. Each time 0 occurs, increment zerocount; when 1 occurs, increment onecount; and so on. Finally, display the number of 0s, 1s, 2s, and so on that occurred and the percentage of time they occurred.Solve the below program in C language. Write a program in C to print all perfect numbers in given range using the function. Test Data :Input lowest search limit of perfect numbers : 1Input lowest search limit of perfect numbers : 100Expected Output : The perfect numbers between 1 to 100 are : 6 28Write a mini program that changes arbitrary base of a logarithmic expression to natural log, base 2, and base 10.Write a program that does addiKon, subtracKon, mulKplicaKon, division, and exponenKaKon of complex numbers.Use the random number funcKons such as rand and randn to answer the following quesKons:a. Generate random integers between 10 and 100 using the rand that gives a random number from uniform distribuKon (0, 1).b. Generate non-zero random integers using the randn funcKon; there is a potenKal. In Octave/MATLAB prgram
- Using C language. Write a program that reads two matrices of integers. It then generates the sum, difference and product of the two matrices. The sum of the two matrices of the same size is a matrix with elements that are the sums of the corresponding elements of the two given matrices. Addition is not defined for matrices of different sizes. If A and B are matrices of the same size, then we define subtraction as follows: A - B = A + (-B). Thus, to subtract matrix B from matrix A, we simply subtract corresponding elements. To multiply a matrix by another matrix we need to do the "dot product" of rows and columns. The "Dot Product" is where we multiply matching members, then sum up: (1, 2, 3) • (7, 9, 11) = 1×7 + 2x9 + 3x11 = 58 We match the 1st members (1 and 7), multiply them, likewise for the 2nd members (2 and 9) and the 3rd members (3 and 11), and finally sum them up.You are asked to write a simple C program that will accept an integer value in the range of 5-95 and as a multiple of 5 representing the number of cents to give to a customer in their change. The program should calculate how many coins of each denomination and display this to the user. Valid coin values are 50, 20, 10 and 5. Your solution (program and algorithm) should be modular in nature. This requires the submission of a high-level algorithm and suitable decompositions of each step. Note that for this problem the principle of code reuse is particularly important and a significant number of marks are allocated to this. You should attempt to design your solution such that it consists of a relatively small number of functions that are as general in design as possible and you should have one function in particular that can be reused (called repeatedly) in order to solve the majority of the problem. If you find that you have developed a large number of functions which each performs a…Write a program in C++ to calculate the actual maximum number of people on the subway at the same time. enter The first line of standard input contains the number of stations (1≤N≤100). The next N rows contain the number of people getting on and off. output The first line of standard output should contain the maximum number of passengers on the subway. Example Input 5 (number of stations) 5 (on) 0 (off) 34 04 20 02 output 5
- Given an integer N and a base X, the task is to find the minimum number of operations required to represent N as a sum of the distinct powers of X. In each operation, you can either increment or decrement N. You are allowed to make the given operation any number of times Examples: Input: N = 7, X = 3 Output: 3.Answer in C++ Only The Company has announced for his staff to have a free Ride service. The City of Jamshedpur has a different structure - all of its N rides are arranged in a circle, counting from 1 to N in a clockwise direction. The Company restaurant is located at Rider number 1. There is a single ring road that runs over the perimeter of this circle and connects all the rides. There are also N - 1 different travel agencies available in Bhiwani. For all the different ride points A and B there is a single connector that connects these points and belongs to the Kth shuttle agency where the K distance between A and B is clockwise, that is, there are K-1 boarding points between points A and B according to by clock. Name the shuttle as (A, B). So if N = 4, the first agency has shuttles (1,2), (2,3), (3,4), (4,1), the second agency has shuttles (1,3)), (2,4) and third-party shuttles are (1,4), (2,1), (3,2), (4,3). If the shuttle connects points A and B, it is possible to move from A to B…Write a c program that counts the number of numbers from 1 to m that are divisible by n. Use the sample run as guide. Sample run: Program to Count the Number of Numbers from 1 to M That are Divisible by NEnter M (>1): 3Enter N (>1): 4There are no numbers from 1 to 3 that are divisible by 4.Enter M (>1): 4Enter N (>1): 2There are 2 numbers from 1 to 4 that are divisible by 2.Enter M (>1): 4Enter N (>1): 3There is 1 number from 1 to 4 that is divisible by 3.Enter M (>1): -5You have entered an invalid input. Program will now terminate.
- Write a python function that takes one integer (n) parameter and prints the first n digits from the Fibonacci series using recursion.Sample input: 5Sample output: 0, 1, 1, 2, 3 Write a function that takes one integer parameter, makes sure it is an integer, prints sum of every two digits and return the sum of digits from the number entered by the user up to 1, using recursion.Sample input: 4 Sample output: 4+3 = 77+2 = 99+1 = 10Create a program for finding roots of polynomial equation using BAIRSTOWS METHOD. Test the code for the function below. f(x)= x6-8x5+25x4-32x3-x2+40x-25=0 Give me the source code of this problem that can run in DEV C++.Write a python function triangle(n) that prints a triangle of numbers of size n as shown below. The numbers must be printed in a field of width 3. triangle(5) will print 123 45 2345 345 45 5