Code:#include <stdlib.h> #include <stdio.h> #include <conio.h> #include <string.h> #include <math.h> #include <ctype.h> #define MAX 11 void main() { float Divide1,Divide2 = 0.0; void function(char,float,float); int Num1; int Num2,y,n=0,k=0,kl,x; char isdigit(char); char Str2[MAX]; char Str1[MAX]; char Operator[1],v; //do-while loop until Exit is Typed do { printf("\nPlease enter the required calculation\n"); //Get first string scanf("%s", Str1); //Exit program if 'Exit' typed if (strcmp(Str1,"Exit") == 0) break; //Get second string scanf("%s", Str2); if (strcmp(Str2,"Exit") == 0) break; // if numbers entered are above MAX display error if (strlen(Str1) > MAX -1) printf("ERROR5"); else if (strlen(Str2) > MAX -1) printf("ERROR5"); Divide1= atof(Str1); Divide2= atof(Str2); //Calculate Squareroot if string2 is an 'S' if ((*Str2) == 'S') printf("=%f\n",sqrt(Divide1) ); //Calculate Reciprocal if string2 is an 'R' else if ((*Str2) == 'R') printf("=%f\n",1/Divide1 ); // Check if strings are alphabetacal if ((*Str2 != 'S') & (*Str2 != 'R')) { y = strlen(Str1); for(x = 0; x < y; x++) { if( !isdigit(Str1[x]) ) { k=1; } } y = strlen(Str2); for(x = 0; x < y; x++) { if( !isdigit(Str1[x]) ) { k=1; } } if (k == 1) { printf("ERROR1"); } else { scanf(" %s", &Operator); if (strlen(Operator) > 1) { n = 2; } if (n != 2) { v=Operator[0]; Num1= atoi(Str1); Num2= atoi(Str2); //Switch statement to calculate Addition,Subtraction,Multiplication and Division switch(v) { case '+': printf("= %d", Num1+Num2); break; case '-': printf("= %d \n", Num1-Num2); break; case '*': printf("=%d ", Num1*Num2); break; case '/': function(*Str2,Divide1,Divide2); break; default: printf("ERROR2"); }} if (n == 2) { printf("ERROR2"); } } } n = 0; k = 0; fflush(stdin); } while(strcmp(Str1, "Exit") != 0); getch(); } //function to display error if divide by '0' else division performed void function(char Str2, float Divide1, float Divide2) { if(Str2 == '0') printf("ERROR3"); else printf("=%f",Divide1/Divide2); }