Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int n,m;
- char c;
- printf("The first number:");
- scanf("%d",&n);
- printf("\nThe second number:");
- scanf("%d",&m);
- printf("\nThe operation:");
- scanf("\n%c",&c);
- if (c=='+')
- {
- int sum=n+m;
- printf("\n %d + %d = %d",n,m,sum);
- }
- else if (c=='-')
- {
- int sub=n-m;
- printf("\n %d - %d = %d",n,m,sub);
- }
- else if (c=='*')
- {
- int mul=n*m;
- printf("\n %d * %d = %d",n,m,mul);
- }
- else if (c=='/')
- {
- float d=n/m;
- printf("\n %d / %d = %d",n,m,d);
- }
- else
- printf("invalid operation ");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement