Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- int main() {
- int a, b, c;
- char d;
- printf("Enter the first integer\n");
- scanf("%d", &a);
- printf("Enter the second integer\n");
- scanf("%d", &b);
- fflush(stdin);
- printf("Enter the sign\n");
- scanf("%c", &d);
- if(d=='+') {
- c=a+b;
- printf("result is %d", c);
- }
- else if(d=='-') {
- c=a-b;
- printf("result is %d", c);
- }
- else if(d=='*') {
- c=a*b;
- printf("result is %d", c);
- }
- else if(d=='/') {
- c=a/b;
- printf("result is %d", c);
- }
- else {
- printf("Try again");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement