Here is my code,
if denominator==0 disp('Division by 0 is not possible.');elseif numerator==0 && denominator==0 disp('The result is indeterminate.');else result = numerator/denominator; fprintf('The result of the fraction is %.2f',result);end
When the denominator is set to 0, it displays "Division by 0 is not possible."
When both the numerator and denominator are set to 0, it still displays "Division by 0 is not possible.". But it should be displaying: "The result is indeterminate.".
I think it's because of the same conditions in if and elseif that is denominator==0.
What should I do?
Thanks in advance!
Best Answer