Question: Write a program to calculate n! for a given number n and perform the simple calculator operations. The valid operations of the calculator are:
Write a program to calculate n! for a given number n and perform the simple calculator operations. The valid operations of the calculator are: + add - sub * mul /div The program must contain a function fact with one input parameter that returns the factorial of a number, a function add that performs the addition of two numbers, a function sub that performs the subtraction of two numbers, a function mul that performs the multiplication of two numbers, a function div that performs the division of two numbers. The program must also check for bad input data. Make sure when you pass parameters you pass the addresses (not the value). All function return type must be of type void. Take inputs in main function. Pass the addresses of the operands and the address of the result to each function. Output must be displayed as follows: 1: Addition 2: Subtraction 3: Multiplication 4: Division 5: Factorial 6: Quit Enter the choice => 1 Enter two numbers => 2, 3 Sum => 5
Step by Step Solution
There are 3 Steps involved in it
Below is a C program that fulfills your requirements The program includes functions for addition sub... View full answer
Get step-by-step solutions from verified subject matter experts
