fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main(void) {
  5. double E = 5, R = 1000, C = 0.1e-6, t, I;
  6.  
  7. printf("t\tI\n");
  8. for (t = 0.0000; t < 0.001; t = t + 0.0001) {
  9. I = E / R * exp(-t / (C * R));
  10. printf("%f\t%f\n", t, I);
  11. }
  12.  
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0s 5252KB
stdin
Standard input is empty
stdout
t	I
0.000000	0.005000
0.000100	0.001839
0.000200	0.000677
0.000300	0.000249
0.000400	0.000092
0.000500	0.000034
0.000600	0.000012
0.000700	0.000005
0.000800	0.000002
0.000900	0.000001