fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4.  
  5. float cr[] = {100, 200, 300, 400};
  6. float rr[] = {0, 400, 800, 1200};
  7.  
  8. float i, vo, vol = 0;
  9. int r, c;
  10. float kr;
  11.  
  12. for( r = 0; r < 4; r++) {
  13. for (c = 0; c < 4; c++ ) {
  14. kr = rr[r]+cr[c];
  15.  
  16. i = 5.0/(1000.0+kr);
  17. vo = 1000.0*i;
  18. printf("R %d:C %d, %f, (%f)\n", r, c, vo, vo/(5.0/1023.0));
  19. printf(" delta %fV (%f)\n", vol-vo, (vol-vo)/(5.0/1023.0));
  20. vol = vo;
  21. }
  22. }
  23.  
  24.  
  25.  
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 2296KB
stdin
Standard input is empty
stdout
R 0:C 0,  4.545454, (929.999971)
                     delta -4.545455V (-929.999991)
R 0:C 1,  4.166667, (852.500044)
                     delta 0.378788V (77.499926)
R 0:C 2,  3.846154, (786.923078)
                     delta 0.320513V (65.577011)
R 0:C 3,  3.571429, (730.714290)
                     delta 0.274725V (56.208776)
R 1:C 0,  3.333333, (682.000017)
                     delta 0.238095V (48.714246)
R 1:C 1,  3.125000, (639.375010)
                     delta 0.208333V (42.625033)
R 1:C 2,  2.941177, (601.764718)
                     delta 0.183824V (37.610306)
R 1:C 3,  2.777778, (568.333347)
                     delta 0.163399V (33.431334)
R 2:C 0,  2.631579, (538.421076)
                     delta 0.146199V (29.912264)
R 2:C 1,  2.500000, (511.499989)
                     delta 0.131579V (26.921096)
R 2:C 2,  2.380952, (487.142876)
                     delta 0.119048V (24.357148)
R 2:C 3,  2.272727, (464.999985)
                     delta 0.108225V (22.142857)
R 3:C 0,  2.173913, (444.782588)
                     delta 0.098814V (20.217395)
R 3:C 1,  2.083333, (426.250022)
                     delta 0.090580V (18.532568)
R 3:C 2,  2.000000, (409.200019)
                     delta 0.083333V (17.050033)
R 3:C 3,  1.923077, (393.461539)
                     delta 0.076923V (15.738473)