In: Computer Science
Write a Python function that accepts three arguments: an array, the size of the array, and a number n. Assume that array contains integers. The function should display all integers in the array that are greater than the number n. Test your function.
Program:
# defining function
def function(array, size, n):
for i in range(size):
# if given array element is greater than given number
if array[i] > n:
# print element
print(array[i])
# creating array to test defined function
array1 = [12, 76, 87, 67, 54, 98, 56, 90, 67, 65] # 10 numbers
array2 = [21, 22, 23, 24, 26, 27, 29, 30, 42, 52, 62, 75, 85, 99] # 14 numbers
# calling defined function to test
print("function(array1, 10, 60): ")
function(array1, 10, 60)
print("function(array2, len(array2), 35): ")
function(array2, len(array2), 35)
Program Snippet:

Output Snippet:

I hope you got the provided solution.
Thank You.