fork download
  1. #include <stdio.h>
  2.  
  3. int operaNum (float num1, char x, float num2){
  4. float soma;
  5. if(x=='*'){
  6. soma = num1*num2;
  7. }else if(x=='+'){
  8. soma = num1+num2;
  9. }else if(x=='-'){
  10. soma = num1-num2;
  11. }else if(x=='/'){
  12. soma = num1/num2;
  13. }
  14.  
  15. return soma;
  16. }
  17.  
  18. int main(){
  19. float a, c, operac;
  20. char b;
  21. scanf("%f %c %f", &a, &b, &c);
  22. operac = operaNum(a, b, c);
  23. printf("%.2f\n", operac);
  24.  
  25. return 0;
  26. }
  27.  
Success #stdin #stdout 0s 10320KB
stdin
6.0*6.0
stdout
36.00