fork download
  1. #include<stdio.h>
  2. int main()
  3. {
  4.  
  5.  
  6. float num1,num2;
  7. int c;
  8. printf("Enter 1st number:\n");
  9. scanf("%f", &num1);
  10. printf("Enter 2nd number:\n");
  11. scanf("%f", &num2);
  12. printf("Choose an option.\n 1.Addition\n 2.Subtraction\n 3.Multiplication\n 4.Division\n");
  13. scanf("%d", &c);
  14. if(c==1)
  15. {
  16. printf("Addition=%.2f\n", num1+num2);
  17. }
  18. else if(c==2)
  19. {
  20. printf("Subtraction=%.2f\n", fabs(num1-num2));
  21.  
  22. }
  23. else if(c==3)
  24. {
  25. printf("Multiplication=%.2f\n", num1*num2);
  26. }
  27. else if(c==4)
  28. {
  29. printf("Division=%.2f\n", num1/num2);
  30. }
  31. else
  32. {
  33. printf("Option Invalid");
  34. }
  35. }
  36.  
Success #stdin #stdout 0s 5268KB
stdin
Standard input is empty
stdout
Enter 1st number:
Enter 2nd number:
Choose an option.
 1.Addition
 2.Subtraction
 3.Multiplication
 4.Division
Option Invalid