Function Related Problems: (Total 20 Questions)
Function Related Problems: (Total 20 Questions)
(Total 20 questions)
4. Function to calculate the sum of n numbers coming from the console and stored in an array. *
9. Function that multiplies the array elements by 2 and returns the array. *
12. Function “GeneratePrime()” to compute the prime numbers less than N, where N is an input ***
integer. GeneratePrime() uses IsPrime() to check whether a number is prime or not.
13. Function “GenNthPrime()” to compute the Nth prime number, where N is an integer input. ***
14. Implement the following functions and calculate standard deviation of an array whose values ***
come from the terminal-
TakeInput()
CalcMean(array, num_of_elem)
Calc_Std_deviation(array, num_of_elem)
Formula:
(Assuming, strlen(a)>strlen(b))
16. Function find_substr( ) that takes two string arrays (a, b) as parameters, uses function ***
str_length() to determine the lengths of the strings, and then looks for the smaller string
anywhere in the bigger string. It returns 1 if the substring is found, or returns –1 if no match
is found.
17. Program that continuously takes two positive integers as inputs and uses two functions to **
find their GCD (greatest common divisor) and LCM (least common multiple). Both functions
take parameters and returns desired values.
InputMatrix()
ShowMatrix()
ScalarMultiply()
19. Program that implements function to perform operations on a MXN matrix: ****
InputMatrix()
ShowMatrix()
ScalarMultiply()
20. Program to convert a positive integer to another base using the following functions- ****