Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this project, we will work to familiarize ourselves with the tools used in this course and practice their use with a simple example. You
In this project, we will work to familiarize ourselves with the tools used in this course and practice their use with a simple example. You will write a program in C called math.c that uses a combination of command line arguments, standard input and standard output to perform basic calculations with and
Only implement integer division for this project this is the default behavior of on integers in C
Program Behavior
Program takes between and arguments
Argument is the operation one of or
Arguments and are optional see below and are the numeric operands
If less than arguments are provided, use scanf to query the operands from the user
DO NOT prompt the user there should only be one printf in your program
Program calls printf to return the numeric result of the operation
ONLY the numeric result should be printed no extra characters
Program's return code MUST match the printed value
Testing
As described in Appendix B you MUST compile your programs using the OWall Werror pedantic stdc gcc options when testing.
gcc OWall Werror pedantic stdco math math.c
Examples
Addition all command line
Command
math
Output
Multiplication all command line
Command
math
Output
Subtraction one command line
Command
math
Input
Output
Division no command lines
Command
math
Input
Output
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started