Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- char f;
- float a, b, c;
- scanf("%f%c%f", &a, &f, &b);
- switch(f) {
- case '+':
- c=a+b;
- break;
- case '-':
- c=a-b;
- break;
- case '*':
- c=a*b;
- break;
- case '/':
- c=a/b;
- default:
- printf("You what?\n");
- return(0);
- }
- printf("Your answer is: %f", c);
- return(0);
- }
- marc@dhcppc3:~/Documents/c> ./calc
- 9
- +
- You what?
- marc@dhcppc3:~/Documents/c>
- it's a stupid calculator! NOOB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement