Code:
#include <stdio.h>
int getInput(void);
int calc(int one, int two);
int intOps(int one, int two);
float doubleOps(int one, int two);
int algebra(int one, int two);
void display(int one, int two, int sum, double half1, double half2,
int quotient, int remainder, double fraction, int algebraSolution);
int main(void)
{
int one, two;
double half1, half2, fraction;
int sum, quotient, remainder;
int algebraSolution;
getInput();
calc(one, two);
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;
}
int calc(int one, int two)
{
intOps(one, two);
doubleOps(one, two);
algebra(one, two);
return intOps, doubleOps, algebra;
}
int intOps(int one, int two)
{
int sum, quotient, remainder;
sum = one + two;
quotient = one / two;
remainder = one % two;
return sum, quotient, remainder;
}
float doubleOps(int one, int two)
{
double half1, half2, fraction;
half1 = (double)one / 2.;
half2 = (double)one / 2.;
fraction = (double)one / two;
return half1, half2, fraction;
}
int algebra(int one, int two)
{
int algebraSolution;
algebraSolution = 2 * one + 4 * two + one * two - one / two;
return algebraSolution;
}
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");
}