#include <stdio.h>#include <stdlib.h>#include <string.h> int main() { char strInputDividend[15], strInputDivider[15], strInputFloatingPoint[15]; //arrays of characters read in from the keyboard and validated against the requirements for the input. int c; //this is the character being read of the keyboard int loop, error, temp, temp1, temp2; //temp, temp1, temp2 are just variables used to hold the result of functions. error is used to test if there is an error in the input. loop is used in forloops int quotient, remainder, result, position; error = 0;//----------------------------------------------//// This loop and the following loops are the input and validation of the input gained from the user.// Basic tests are done on the data to see it is integers being passed, and also the messages are printed to the terminal.////---------------------------------------------- while (error != 1){ error = 0; printf("Dividend?\n"); for (loop = 0; (c = getchar()) != EOF && c != '\n' && loop < 2; loop++){ if (c >= '0' && c <= '9'){ strInputDividend[loop] = c; } else { error = 1; } } if (error == 1){ printf("Wrong Entry\n"); error = 0; } else { break; } } temp = atoi(strInputDividend); //convert the array of chars into intergers to print. temp = 0; while (error != 1){ error = 0; printf("Divider?\n"); for (loop = 0; (c = getchar()) != EOF && c != '\n' && loop < 2; loop++){ if (c >= '0' && c <= '9'){ strInputDivider[loop] = c; } else { error = 1; } } if (error == 1 || strInputDivider[0] == '0'){ printf("Wrong Entry\n"); error = 0; } else { break; } } temp1 = atoi(strInputDivider); while (error != 1){ error = 0; printf("Number of floating digits required?\n"); for (loop = 0; (c = getchar()) != EOF && c != '\n' && loop < 2; loop++){ if (c >= '1' && c <= '9'){ strInputFloatingPoint[loop] = c; } else { error = 1; } } if (error == 1){ printf("Wrong Entry\n"); error = 0; } else { break; } } temp2 = atoi(strInputFloatingPoint); temp2++; char floatingPointArray[temp2]; int intInputDividend, intInputDivider; intInputDividend = atoi(strInputDividend); intInputDivider = atoi(strInputDivider); /*remainder = 1; quotient = 0; remainder = 0; quotient = (atoi(strInputDividend) / atoi(strInputDivider)); remainder = (atoi(strInputDividend) % atoi(strInputDivider)); result = quotient; floatingPointArray[0] = quotient; for (loop = 1; loop < temp2+1 || remainder == 0; loop++){ quotient = ((remainder*10) / atoi(strInputDivider)); remainder = ((remainder*10) % atoi(strInputDivider)); floatingPointArray[loop] = remainder; } for (loop = 0; loop < temp2; loop++){ if (loop == 1){ printf("."); } printf("%d", floatingPointArray[loop]); //int temp55 = atoi(floatingPointArray[loop]); //printf("%d", temp55); }*/ printf("\n"); return 0;}int division(int strInputDividend, int strInputDivider, int position){ int quotient = 0; int remainder = 0; int result = 0; int divider = 0; int dividend = 0; int answer = 0; int loop; dividend = strInputDividend; divider = strInputDivider; for (loop = 0; result > divider; loop++){ result = dividend - divider; } quotient = result; result = 0; result = dividend - (divider*loop); remainder = result; if ((remainder - divider) <= '0'){ floatingPointArray[position] = quotient; } else { division(quotient, remainder, position); } return floatingPointArray;}