Problems don't forget to comment your code! P1. Wnite a function called anthmetic that takes two scalar input arguments (the function does not have to check the format of the input) and retums up to four output arguments. The outputs are the sum, difference, product and ratio of the two inputs, respectively If the second input argument is not provided, it is set to equal the first. Here are a few example runs:

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.1: Function And Parameter Declarations
Problem 2E
icon
Related questions
Question
Problems don't forget to comment your code!
P1. Write a function called anthmetic that takes two scalar input arguments (the function does not have to
check the format of the input) and retums up to four output arguments. The outputs are the sum, difference,
product and ratio of the two inputs, respectively If the second input argument is not provided, it is set to equal
the first. Here are a few example runs.
» arithmetic (3, 2)
ans =
5
> [a b c] = arithmetic (3, 2)
a =
b =
1
C =
> [a bc d] = arithmetic (3)
a =
b =
C =
9.
d =
Transcribed Image Text:Problems don't forget to comment your code! P1. Write a function called anthmetic that takes two scalar input arguments (the function does not have to check the format of the input) and retums up to four output arguments. The outputs are the sum, difference, product and ratio of the two inputs, respectively If the second input argument is not provided, it is set to equal the first. Here are a few example runs. » arithmetic (3, 2) ans = 5 > [a b c] = arithmetic (3, 2) a = b = 1 C = > [a bc d] = arithmetic (3) a = b = C = 9. d =
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Types of Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr