Posted By

attomos on 11/26/10


Tagged

os lab


Versions (?)

calculator.c


 / Published in: C
 

  1. #include <stdio.h>
  2.  
  3. int main() {
  4. float a, b;
  5. a = 0;
  6. b = 0;
  7. printf("Enter a: ");
  8. scanf("%f", &a);
  9. printf("Enter b: ");
  10. scanf("%f", &b);
  11.  
  12. printf("%5.2f + %5.2f = %5.2f\n", a, b, a + b);
  13. printf("%5.2f - %5.2f = %5.2f\n", a, b, a - b);
  14. printf("%5.2f * %5.2f = %5.2f\n", a, b, a * b);
  15. printf("%5.2f / %5.2f = %5.2f\n", a, b, a / b);
  16. return 1;
  17. }

Report this snippet  

You need to login to post a comment.