fork download
  1. #include<stdio.h>
  2. int main()
  3. {
  4. float num1,num2;
  5. int c;
  6. printf("Enter 2 numbers:\n");
  7. scanf("%f %f",&num1,&num2);
  8. float add=num1+num2;
  9. float sub=fabs(num1-num2);
  10. float mul=num1*num2;
  11. float div=num1/num2;
  12. printf("choose an option.\n1.Addition\n2.substraction\n3.multiplication\n4.divition");
  13. scanf("%d",&c);
  14. if(c==1)
  15. {
  16. printf("addition : %.2f\n",add);
  17. }
  18. else if (c==2)
  19. {
  20. printf("subtraction : %.2f\n",sub);
  21. }
  22. else if(c==3)
  23. {
  24. printf("multiplication : %.2f\n",mul);
  25. }
  26. else
  27. {
  28. printf("division : %.2f",div);
  29. }
  30.  
  31.  
  32. }
  33.  
Success #stdin #stdout 0s 5272KB
stdin
Standard input is empty
stdout
Enter 2 numbers:
choose an option.
1.Addition
2.substraction
3.multiplication
4.divitiondivision : -0.00