fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. float a, b;
  5.  
  6. printf("Enter two numbers: ");
  7. scanf("%f %f", &a, &b);
  8.  
  9. printf("sum = %.2f\n", a + b);
  10. printf("subtract = %.2f\n", a - b);
  11. printf("multiply = %.2f\n", a * b);
  12.  
  13. if (b != 0) {
  14. printf("divide = %.2f\n", a / b);
  15. } else {
  16. printf("Cannot divide by zero!\n");
  17. }
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 5288KB
stdin




stdout
Enter two numbers: sum = 0.00
subtract = 0.00
multiply = 0.00
divide = 2075880767990855106560.00