Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int num1, num2, result;
- char operand;
- printf ("\nEnter first number\n");
- scanf ("%d", &num1);
- printf ("\nEnter second number\n");
- scanf ("%d", &num2);
- printf ("\nWhat mathematical operation would you like to perform?\n");
- printf ("\nEnter + to add");
- printf ("\nEnter - to substract");
- printf ("\nEnter * to multiply");
- scanf("%c", &operand);
- switch (operand)
- {
- case '+': result = num1 + num2;
- printf ("your addition yields =", result);
- break;
- case '-': result = num1 - num2;
- printf ("your substraction yields =", result);
- break;
- case '*': result = num1 * num2;
- printf ("your multiplication yields =", result);
- break;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement