Home /
Expert Answers /
Computer Science /
write-a-function-called-divide-which-divides-two-numbers-and-keeps-count-of-how-many-times-the-fun-pa238
(Solved): Write a function called Divide which divides two numbers, and keeps count of how many times the fun ...
Write a function called Divide which divides two numbers, and keeps count of how many times the function was called asking to divide by zero. The function has two outputs \( z \), the division of the two numbers, and times, the number of times the function was called with a avide-by-zero request. In the case of a divide-by-zero request, the resultant should be set to not a number (NaN) Pestrictions. The function must make use of a persistent variable. \( \mathrm{Ex} \) Function 0
Code to call your function 0 CReset Assessment: Check the first instance of Divide \( (1,1) \) returns \( z=1 \) times \( =0 \). Check the first instance Divide \( (1,0) \) returns \( z= \) NaN times \( =1 \). Check the counter operates correctly. Check a persistent variable is used.