Advertisement
Paul51

Custom header based calculator program.

Jan 2nd, 2017
462
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<operations.h>
  3. void main()
  4. {
  5. int a,b,option;
  6. printf("enter two numbers \n");
  7. scanf("%d",&a);
  8. scanf("%d",&b);
  9. printf("Select your option \n");
  10. printf("1. add the numbers \n");
  11. printf("2. multiply the numbers \n");
  12. printf("3. divide the numbers \n");
  13. printf("4. subtract the numbers \n");
  14. scanf("%d",&option);
  15. switch(option)
  16. {
  17. case 1:
  18. add(a,b);
  19. break;
  20. case 2:
  21. divide(a,b);
  22. break;
  23. case 3:
  24. multiply(a,b);
  25. break;
  26. case 4:
  27. subtract(a,b);
  28. break;
  29. default:
  30. printf("invalid");
  31. break;
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement