Assignment (function )
1. Write the following function's prototype:
function name
|
return type
|
input data type
|
cubic
|
double
|
Two input of double values
|
delete_blanks
|
none
|
none
|
random
|
integer
|
none
|
2. Write a function prime that return 1 if its argument is a prime number and return 0 otherwise.
3. Write a function called arraysum that takes two arguments: integer array and the number of elements in the array. Have the function return as its result the sum of the element in the array.
4. Modify the sort function to take a third argument indicating whether the array is to be sorted in ascending order or descending order. Then modify the sort algorithm to correctly sort the array into the indicated order.
5. Write two functions called Gcd and Lcm. The Gcd function takes two positive integers as its parameters and returns their greatest common divisor. .The Lcm function takes two positive integers as its parameters and returns their least common multiple. The Lcm function should calculate the least common multiple by calling the Gcd function.
6. Write a recursive function to calculate the nth power of x.
Xn = { 1 (n = 0)
{ x*xn-1 (n > 0 n = 1, 2, 3,... )