#define ADDITION = addition
#define SUBTRACTION = subtraction
#define MULTIPLICATION = multiplication
#define DIVISION = division
#define MODULAR = modular
#endif
int main() {
int userInput = 0;
int userInput2 = 0;
int userInput3 = 'A', 'S', 'M', 'D', 'Q';
int sum = 0;
// modular is q while m is multiplication
printf(" Programming Assignment #2 - by Geoffrey \n");
printf("\n");
printf("please enter the First Number:");
scanf("%d", &userInput);
fflush(stdin);
printf("please enter the Second Number:");
scanf("%d", &userInput2);
fflush(stdin);
if (userInput >= -1000 && userInput <= 1000 && userInput2 >= -1000 && userInput2 <= 1000); {
printf("Please select an operation to put in the blank space");
printf("%d_%d=", userInput, userInput2);
}
if else (userInput <= -1001 && userInput >= 1001 && userInput2 <= -1001 && userInput >= 1001); {
printf("Please Re-enter a number between -1000 and 1000");
scanf("%d", &userInput);
fflush(stdin);
scanf("%d", &userInput2);
fflush(stdin);
}
while (userInput >= -1000 && userInput <= 1000 && userInput2 >= -1000 && userInput2 <= 1000 == 1); {
printf("type the associated letter and press enter:\n");
printf(" A - Addition\n S - Subtraction\n M - Multiplication\n D - Division\n Q - Modular\n");
scanf("%c", userInput3);
fflush(stdin);
while (userInput3 == 'A'); {
printf("%d + d% = %d",sum = userInput + userInput2);
while (userInput3 == 'S'); {
printf("%d - %d = %d", sum = userInput - userInput2);
while (userInput3 == 'M'); {
printf("%d * %d = %d", sum = userInput * userInput3);
while (userInput3 == 'D'); {
printf("%d / %d = %1d", sum = userInput / userInput2);
while (userInput3 == 'Q'); {
printf("%d % %d = %d", sum = userInput % userInput2);
while (userInput3 == 0 ); {
printf("Please Type eithor: A,S,M,D,Q\n");
}
}
}
}
}
}
}
return(0);
}
geoffy0404 0 Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.