Code:
#include <stdio.h>
//function declarations
int getInput(void);
void calc(int one, int two, int *sum, int *quotient, *int remainder,
double *half1, double *half2, double *fraction, int *algebra
Solution);
int intOps(int one, int two, int *sum, int *quotient, int *remainder);
void doubleOps(int one, int two, double *half1, double *half2, double *fraction);
int algebra(int one, int two, int *algebraSolution);
void display(int one, int two, int sum, double half1, double half2,
int quotient, int remainder, double fraction, int algebraSolution);
int main(void)
{
//local declarations
int one, two;
double half1, half2, fraction;
int sum, quotient, remainder;
int algebraSolution;
//statements
getInput();
calc(one, two, &sum, "ient, &remainder, &half1, &half2, &fraction, &algebraSolution);
display(one, two, sum, half1, half2, quotient, remainder,
fraction, algebraSolution);
return 0;
}
int getInput(void)
{
int one, two;
printf("\nPlease enter two integers ");
scanf("%d%d", &one, &two);
return one, two;
}
void calc(int one, int two, int *sum, int *quotient, *int remainder,
double *half1, double *half2, double *fraction, int *algebra
Solution)
{
intOps(int one, int two, int *sum, int *quotient, int *remainder);
doubleOps(int one, int two, double *half1, double *half2, double *fraction);
algebra(int one, int two, int *algebraSolution);
}
int intOps(int one, int two, int *sum, int *quotient, int *remainder)
{
*sum = one + two;
*quotient = one / two;
*remainder = one % two;
}
void doubleOps(int one, int two, double *half1, double *half2, double *fraction)
{
*half1 = (double)one / 2.;
*half2 = (double)one / 2.;
*fraction = (double)one / two;
}
int algebra(int one, int two, int *algebraSolution)
{
*algebraSolution = 2 * one + 4 * two + one * two - one / two;
}
void display(int one, int two, int sum, double half1, double half2,
int quotient, int remainder, double fraction, int algebraSolution)
{
printf("\n%20s%20d", "Integer 1", one);
printf("\n%20s%20d", "Integer 2", two);
printf("\n%20s%20d", "Sum", sum);
printf("\n%20s%20.1f", "Half of Integer 1", half1);
printf("\n%20s%20.1f", "Half of Integer 2", half2);
printf("\n%20s%20d", "Quotient", quotient);
printf("\n%20s%20d", "Remainder", remainder);
printf("\n%20s%20.4f", "Fraction", fraction);
printf("\n%20s%20d", "Algebra Solution", algebraSolution);
printf("\n\n");
}