Function Programming

Function Programming

Q : Write a function fnmat() which takes matrix, m, n as arguments where matrix is of size mXn with m as rows and n as columns. Function should return the maximum and minimum elements of the matrix. Elements of matrix are of integer type.

Q : Write down three different methods used for referencing multiple values from a function.

Q : Define recursion. Write a complete program to evaluate the given series using recursive
function sum( ). Here n is user dependent. 1 + 2 + 3 +…+ n

Q :  How does passing an array as an argument to a function differ from call by value?

Q : Write a function in ‘C’, using pointers for the array of elements, for sorting the elements.

Q : Write a function which receives two integer arrays and creates a third array by multiplying corresponding elements (elements with same index) and returns it to main program.

Q : Write a function which accepts an array of size n containing integer values and returns the average of all values. Call the function from main program.

Q : Write a function that takes time in seconds as input and prints it in terms of hours, minutes and seconds.

Q : Write a ‘C’ function to calculate matrix C such that C=A+B Use suitable loops. Make use of pointers if necessary

Q : Write a function in ‘C’ to print even numbers from 1 to 100.


No comments:

Post a Comment