fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. float s = 0;
  5. float start = 0.5;
  6. float end = 2;
  7. float r = 0.5;
  8. for (float i = start; i <= end; i += r ){
  9. s += i;
  10. }
  11. printf("%f == %f", s, 0.5 + 1 + 1.5 + 2);
  12. return 0;
  13. }
  14.  
Success #stdin #stdout 0.01s 9424KB
stdin
Standard input is empty
stdout
5.000000 == 5.000000