fork download
  1. #include <stdio.h>
  2. float miasomma(float x, float y);
  3. int main()
  4. {
  5. float a;
  6. float tot=1;
  7. scanf("%f", &a);
  8. while (a != -1)
  9. {
  10. tot = miasomma(a, tot);
  11. printf("%.2f\n", tot);
  12. scanf("%f", &a);
  13. }
  14. printf("%.2f\n", tot);
  15. return 0;
  16. }
  17.  
  18. float miasomma(float x, float y)
  19. {
  20. float somma;
  21. somma = x * y;
  22. return somma;
  23. }
  24.  
Success #stdin #stdout 0s 2172KB
stdin
1 2 3 -1
stdout
1.00
2.00
6.00
6.00