Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int a,b;
  5. char c;
  6. scanf("%d %c %d",&a,&c,&b);
  7. if(c=='+')
  8. {
  9. printf("sum %d",a+b);
  10. }
  11. else if(c=='-')
  12. {
  13. printf("sum %d",a-b);
  14. }
  15. else if(c=='*')
  16. {
  17. printf("sum %d",a*b);
  18. }
  19. else if(c=='-')
  20. {
  21. if(b>0)
  22. {
  23. printf("sum %d",(float)(a/b));
  24. }
  25. else
  26. {
  27. printf("Error ");
  28. }
  29.  
  30. }
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement