//TestCode.java
import java.util.Scanner;
public class TestCode{
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter a number: ");
int n = scanner.nextInt();
System.out.println("Cube without using Math library = "+ (n*n*n));
System.out.println("Cube using Math library = "+ (Math.pow(n,3)));
}
}


Write two small code segments to calculate the cube value of an integer. The first code...
Write a program that takes in two integers and finds the remainder of the first integer divided by the second integer, WITHOUT USING THE MOD OPERATOR. You may not use the modulus operator to do this, you are to use a looping construct to do this. C++
Languge C Code Write a program that acts as an integer calculator that supports a single arithmetic operation at a time. The user should enter the calculation on a single line. The program should continuously accept new inputs before until the user submits a blank line (return). The program should support all of the following operations: +, -, *, /, % (modulo). It should not be necessary to use the math.h library. Your program should not produce any output except...
Write a program that computes the Fibonacci number for some input integer. (See segments 7.37 – 7.41 in your book for some info on the Fibonacci sequence or you can look it up on the Internet). The sequence is defined as the first two elements are each 1, after that each element in the sequence is the sum of the previous two elements. The first few numbers of the sequence are 1,1,2,3,5,8,13,21,34,55,… Your assignment is to write a program with...
write a function that will determine if an integer is prime. you should return 1 if the value is prime and 0 otherwise. you may not use the math library. create both function and prototype.
5.20 (Ch 5) HW: Output range with increment of 10 Write a program whose input is two integers, and whose output is the first integer and subsequent increments of 10 as long as the value is less than or equal to the second integer Ex: If the input is: -15 30 Then the output is: 15 -5 5 15 25 Ex: If the second integer is less than the first as in 20 5, the output is: Second integer can't be less than the...
MATLAB Write segment of code using nested for loops to print out the following pattern. Your segments of code should prompt the user for a positive integer, n, and print the following star pattern depending on n. An equilateral triangle. Pictured below is case n = 6. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *...
Problem 2. Write a program that contains two segments: A data segment called SEG DATA that contains two variables NUM1 and NUM2 where the size of each is one byte. A code segment SEG CODE that will compute the sum of even and odd values of a memory block of size 10 bytes that is saved at DS:0200H. The sum of even values should be saved in NUM1 and the sum of odd values in NUM2.
c++ show code thanks,
only use library <iostream>
Question 1 Write the following two functions The first function accepts as input a two-dimensional array of integers. It returns two results: the sum of the elements of the array and the average The second function accepts as input a two-dimensional array of integers and integer value V. It returns true if the value V is found in the array, false otherwise. Write a main program that declares and initializes the following...
Design optimum polynomial for constant velocity critical path motion (for two segments) an with the following problem statement: Maintain a constant velocity of 10 cm/s for 0.5s and accelerate follower to constant velocity Decelerate exactly 1 s Cycle time function Poly 1 Poly 5 segment 2 (o) 10 cm/s 180 0 180 10 6 0 (b) 180 180 0 0 2 a k 0 (c) 180 180 local 0 360 deg 180 180 global e (a) Write down the boundary...
Write a program that compares the execution speed of two different sorting algorithms: bubble sort and selection sort. It should do this via functions you must write with the following prototypes: void setRandomValues(int[], int[], int length); This function sets two integer arrays with identical random values. The first two arguments are two integer arrays of the same length, and the third argument is the length of those arrays. The function then sets each element in the first and second argument...