daily pastebin goal
74%
SHARE
TWEET

Calculator

a guest May 17th, 2018 123 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     double A, B;
  5.     char Ch;
  6.     scanf("%lf %c %lf", &A, &Ch, &B);
  7.     if(Ch == '+'){
  8.     printf("%.2lf + %.2lf = Sum: %.2lf\n",A, B, A+B);
  9.     }
  10.     else if(Ch == '-'){
  11.     printf("%.2lf - %.2lf = Subtraction: %.2lf\n", A, B, A-B);
  12.     }
  13.     else if(Ch == '*'){
  14.     printf("%.2lf * %.2lf = Multiple: %.2lf\n", A, B, A*B);
  15.     }
  16.     else{
  17.     printf("%.2lf / %.2lf = Divided: %.2lf\n", A, B, A/B);
  18.     }
  19.  
  20.     return 0;
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top