Menu

[Solved]Mymathfunction Programming C Able Change Number Get Result Anytime Hard Code Write Functio Q37226059

MyMathFunction

Programming in C#, and able to changethe number to get the result anytime. Not the hardcode

Write a function that takes in two numbers and a function name.The function should call the function name in the parameter passingit the two number to perform a math operation and returning theresult. Your MyMathFunction should be able to handle 4 differentmath operations (add, subtract, divide, and multiply). You mustwrite 5 functions to complete this assignment correctly(MyMathFunction, Add, Subtract, Multiply, Divide). Hint: Do notpass the function name as a string. Look at Delegates.

MyMathFunction(10, 10, Multiply);

100

MyMathFunction(50, 10, Divide);

5

MyMathFunction(10, 0, Divide);

Cannot Divide by 0!

MyMathFunction(20, 25, Add);

45

MyMathFunction(25, 20, Subtract);

5

Expert Answer


Answer to MyMathFunction Programming in C#, and able to change the number to get the result anytime. Not the hard code Write a fun… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *