And the source code is:
- Code: Select all
#include <stdio.h>
int main(void)
{
int numb1;
int numb2;
int numb3;
int oper;
printf("Enter the first number. ");
scanf("%d", &numb1);
printf("Enter the second number. ");
scanf("%d", &numb2);
printf("Enter the ASCII operator (43 (adding), 45 (subtracting), 42 (multiplying), or 47 (dividing). ");
scanf("%d", &oper);
if (oper == 43)
{
numb3 = numb1 + numb2;
printf("The result is: %d", numb3);
}
else if (oper == 45)
{
numb3 = numb1 - numb2;
printf("The result is: %d", numb3);
}
else if (oper == 42)
{
numb3 = numb1 * numb2;
printf("The result is: %d", numb3);
}
else if (oper == 47)
{
if (numb2 > 0)
{
numb3 = numb1 / numb2;
printf("The result is: %d", numb3);
}
else
{
printf("\nYou cannot enter a number below 1!\n");
}
}
else
{
printf("You entered a wrong ASCII char.\n");
}
return 0;
}
Damn it.
The forums screw up the code spacing. >:U
I hope you don't mind it.
(I am not posting a download link unless people ask. That means you'll have to compile it yourself (After fixing the indentation that the forums messed up)).



