Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How many times divide by zero? Write a function Divide that divides two numbers, and keep count of how many times the function was called

image text in transcribed

image text in transcribed

How many times divide by zero? Write a function Divide that divides two numbers, and keep count of how many times the function was called asking to divide by zero. The function has two output, the division of the two numbers and the number of times the function was called with a divide-by-zero request. In the case of a divide-by-zero request, the resultant should be set to not a number. The function must make use of a persistant variable. For example >> clear all; xs]; y=1; [z,times] Divide(x,y) times = >> x-1 ; y=0; [2,times] Divide(x,y) NaN times y=0; [z,times] Divide(x,y) >> x=2; howmany = 2 NaN times = 2 Your Function ave CReset MATLAB Documentation 1 function [z,times] Divide(x,y) % Your code goes here % 4 s end

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions

Question

1. What is meant by Latitudes? 2. What is cartography ?

Answered: 1 week ago

Question

=+ how might this lead to faster growth in productivity?

Answered: 1 week ago