To help with potential debugging problems, here is one example run annotated with the account balance and interest balance at the end of each simulated day in a five week simulation.
~/$ ./part4
paycheck = 600
loanrate = 17.5
saverate = 4.5
run 40 n500.txt
initibal = 700
paycheck = 600
saverate = 4.5
loanrate = 17.5
End of day 1: balance = 663.75, interest = 0.0818322
End of day 2: balance = 656.25, interest = 0.16274
End of day 3: balance = 595.75, interest = 0.236188
End of day 4: balance = 588, interest = 0.308682
End of day 5: balance = 547, interest = 0.37612
End of day 6: balance = 484.75, interest = 0.435884
End of day 7: balance = 443.75, interest = 0.490592
End of day 8: balance = 419.5, interest = 0.542312
End of day 9: balance = 365.5, interest = 0.587373
End of day 10: balance = 319.5, interest = 0.626764
End of day 11: balance = 215.75, interest = 0.653363
End of day 12: balance = 164.5, interest = 0.673644
End of day 13: balance = 693.75, interest = 0.759175
End of day 14: balance = 630.25, interest = 0.836877
End of day 15: balance = 594, interest = 0.91011
End of day 16: balance = 564, interest = 0.979644
End of day 17: balance = 544.5, interest = 1.04677
End of day 18: balance = 465.25, interest = 1.10413
End of day 19: balance = 453.25, interest = 1.16001
End of day 20: balance = 436.5, interest = 1.21383
End of day 21: balance = 412.25, interest = 1.26465
End of day 22: balance = 370.75, interest = 1.31036
End of day 23: balance = 357.5, interest = 1.35444
End of day 24: balance = 318, interest = 1.39364
End of day 25: balance = 283.5, interest = 1.4286
End of day 26: balance = 264, interest = 1.46114
End of day 27: balance = 826.25, interest = 1.56301
End of day 28: balance = 760.5, interest = 1.65677
End of day 29: balance = 709.25, interest = 1.74421
End of day 30: balance = 691.75, interest = 1.8295
End of day 31: balance = 611.579, interest = 0.0754002
End of day 32: balance = 547.329, interest = 0.142879
End of day 33: balance = 517.329, interest = 0.20666
End of day 34: balance = 457.079, interest = 0.263012
End of day 35: balance = 380.829, interest = 0.309963
End of day 36: balance = 339.329, interest = 0.351799
End of day 37: balance = 307.829, interest = 0.38975
End of day 38: balance = 233.329, interest = 0.418517
End of day 39: balance = 232.829, interest = 0.447222
End of day 40: balance = 196.829, interest = 0.471488
End of day 41: balance = 771.079, interest = 0.566553
End of day 42: balance = 728.829, interest = 0.656409
End of day 43: balance = 638.579, interest = 0.735138
End of day 44: balance = 598.829, interest = 0.808966
End of day 45: balance = 571.079, interest = 0.879373
End of day 46: balance = 540.579, interest = 0.94602
End of day 47: balance = 518.829, interest = 1.00999
End of day 48: balance = 508.579, interest = 1.07269
End of day 49: balance = 444.579, interest = 1.1275
End of day 50: balance = 371.329, interest = 1.17328
End of day 51: balance = 371.079, interest = 1.21903
End of day 52: balance = 360.329, interest = 1.26345
End of day 53: balance = 273.329, interest = 1.29715
End of day 54: balance = 228.579, interest = 1.32533
End of day 55: balance = 793.329, interest = 1.42314
End of day 56: balance = 710.829, interest = 1.51078
End of day 57: balance = 653.829, interest = 1.59138
End of day 58: balance = 614.329, interest = 1.66712
End of day 59: balance = 558.829, interest = 1.73602
End of day 60: balance = 554.829, interest = 1.80442
End of day 61: balance = 483.134, interest = 0.0595645
End of day 62: balance = 426.384, interest = 0.112132
End of day 63: balance = 389.884, interest = 0.1602
End of day 64: balance = 321.634, interest = 0.199854
End of day 65: balance = 288.134, interest = 0.235377
End of day 66: balance = 260.634, interest = 0.26751
End of day 67: balance = 252.134, interest = 0.298595
End of day 68: balance = 216.134, interest = 0.325242
End of day 69: balance = 809.134, interest = 0.424998
End of day 70: balance = 746.634, interest = 0.517049
End of day 71: balance = 709.134, interest = 0.604476
End of day 72: balance = 666.134, interest = 0.686602
End of day 73: balance = 628.134, interest = 0.764043
End of day 74: balance = 587.634, interest = 0.836491
End of day 75: balance = 513.384, interest = 0.899785
End of day 76: balance = 478.134, interest = 0.958733
End of day 77: balance = 398.384, interest = 1.00785
End of day 78: balance = 325.384, interest = 1.04797
End of day 79: balance = 271.884, interest = 1.08148
End of day 80: balance = 227.884, interest = 1.10958
End of day 81: balance = 186.134, interest = 1.13253
End of day 82: balance = 142.384, interest = 1.15008
End of day 83: balance = 672.634, interest = 1.23301
End of day 84: balance = 639.384, interest = 1.31184
End of day 85: balance = 571.384, interest = 1.38228
End of day 86: balance = 501.634, interest = 1.44413
End of day 87: balance = 483.884, interest = 1.50378
End of day 88: balance = 442.634, interest = 1.55836
End of day 89: balance = 342.384, interest = 1.60057
End of day 90: balance = 306.134, interest = 1.63831
End of day 91: balance = 244.522, interest = 0.0301466
End of day 92: balance = 164.272, interest = 0.0503993
End of day 93: balance = 132.272, interest = 0.0667069
End of day 94: balance = 107.022, interest = 0.0799014
End of day 95: balance = 79.2722, interest = 0.0896747
End of day 96: balance = 56.7722, interest = 0.096674
End of day 97: balance = 568.772, interest = 0.166797
End of day 98: balance = 501.272, interest = 0.228597
End of day 99: balance = 446.522, interest = 0.283648
End of day 100: balance = 443.772, interest = 0.33836
End of day 101: balance = 387.022, interest = 0.386075
End of day 102: balance = 330.522, interest = 0.426824
End of day 103: balance = 294.522, interest = 0.463135
End of day 104: balance = 282.272, interest = 0.497936
End of day 105: balance = 272.022, interest = 0.531473
End of day 106: balance = 253.272, interest = 0.562698
End of day 107: balance = 185.772, interest = 0.585601
End of day 108: balance = 157.272, interest = 0.604991
End of day 109: balance = 81.2722, interest = 0.615011
End of day 110: balance = 52.0222, interest = 0.621425
End of day 111: balance = 622.022, interest = 0.698112
End of day 112: balance = 595.522, interest = 0.771533
End of day 113: balance = 563.772, interest = 0.841039
End of day 114: balance = 487.772, interest = 0.901175
End of day 115: balance = 431.272, interest = 0.954346
End of day 116: balance = 370.272, interest = 0.999996
End of day 117: balance = 290.522, interest = 1.03581
End of day 118: balance = 223.522, interest = 1.06337
End of day 119: balance = 181.522, interest = 1.08575
End of day 120: balance = 172.272, interest = 1.10699
End of day 121: balance = 83.6292, interest = 0.0103105
End of day 122: balance = 22.1292, interest = 0.0130387
End of day 123: balance = -22.6208, interest = 0.00219313
End of day 124: balance = -58.1208, interest = -0.025673
End of day 125: balance = 484.629, interest = 0.0340758
End of day 126: balance = 370.629, interest = 0.0797698
End of day 127: balance = 306.629, interest = 0.117573
End of day 128: balance = 297.879, interest = 0.154298
End of day 129: balance = 288.129, interest = 0.189821
End of day 130: balance = 252.879, interest = 0.220998
End of day 131: balance = 220.879, interest = 0.24823
End of day 132: balance = 145.629, interest = 0.266184
End of day 133: balance = 78.3792, interest = 0.275847
End of day 134: balance = -22.8708, interest = 0.264882
End of day 135: balance = -47.8708, interest = 0.24193
End of day 136: balance = -55.6208, interest = 0.215262
End of day 137: balance = -105.371, interest = 0.164742
End of day 138: balance = -154.621, interest = 0.0906089
End of day 139: balance = 410.129, interest = 0.141173
End of day 140: balance = 334.129, interest = 0.182367
End of day 141: balance = 247.129, interest = 0.212835
End of day 142: balance = 218.879, interest = 0.23982
End of day 143: balance = 147.129, interest = 0.257959
End of day 144: balance = 82.6292, interest = 0.268146
End of day 145: balance = 35.1292, interest = 0.272477
End of day 146: balance = -16.8708, interest = 0.264389
End of day 147: balance = -57.1208, interest = 0.237002
End of day 148: balance = -90.6208, interest = 0.193554
End of day 149: balance = -137.371, interest = 0.127691
End of day 150: balance = -220.621, interest = 0.0219138
End of day 151: balance = -286.849, interest = -0.13753
End of day 152: balance = -302.099, interest = -0.282372
End of day 153: balance = 277.401, interest = -0.248172
End of day 154: balance = 246.651, interest = -0.217763
End of day 155: balance = 221.651, interest = -0.190436
End of day 156: balance = 206.651, interest = -0.164959
End of day 157: balance = 99.1511, interest = -0.152735
End of day 158: balance = 51.6511, interest = -0.146367
End of day 159: balance = 19.6511, interest = -0.143944
End of day 160: balance = -45.3489, interest = -0.165686
End of day 161: balance = -85.0989, interest = -0.206487
End of day 162: balance = -110.349, interest = -0.259394
End of day 163: balance = -158.099, interest = -0.335195
End of day 164: balance = -248.599, interest = -0.454386
End of day 165: balance = -283.099, interest = -0.590119
End of day 166: balance = -316.349, interest = -0.741793
End of day 167: balance = 272.151, interest = -0.70824
End of day 168: balance = 223.401, interest = -0.680697
End of day 169: balance = 198.151, interest = -0.656268
End of day 170: balance = 150.901, interest = -0.637663
End of day 171: balance = 99.6511, interest = -0.625378
End of day 172: balance = 0.151135, interest = -0.625359
End of day 173: balance = -22.5989, interest = -0.636194
End of day 174: balance = -69.5989, interest = -0.669563
End of day 175: balance = -101.599, interest = -0.718275
End of day 176: balance = -103.849, interest = -0.768066
End of day 177: balance = -170.599, interest = -0.84986
End of day 178: balance = -225.599, interest = -0.958024
End of day 179: balance = -242.849, interest = -1.07446
End of day 180: balance = -307.349, interest = -1.22182
End of day 181: balance = 228.679, interest = 0.0281933
End of day 182: balance = 164.179, interest = 0.0484346
End of day 183: balance = 127.679, interest = 0.0641759
End of day 184: balance = 86.1793, interest = 0.0748008
End of day 185: balance = 26.6793, interest = 0.07809
End of day 186: balance = 22.1793, interest = 0.0808244
End of day 187: balance = 21.4293, interest = 0.0834664
End of day 188: balance = 0.429318, interest = 0.0835193
End of day 189: balance = -30.3207, interest = 0.068982
End of day 190: balance = -61.0707, interest = 0.0397015
End of day 191: balance = -113.071, interest = -0.0145104
End of day 192: balance = -157.321, interest = -0.0899381
End of day 193: balance = -192.821, interest = -0.182386
End of day 194: balance = -234.071, interest = -0.294612
End of day 195: balance = 328.929, interest = -0.254059
End of day 196: balance = 287.429, interest = -0.218623
End of day 197: balance = 269.679, interest = -0.185375
End of day 198: balance = 228.679, interest = -0.157181
End of day 199: balance = 210.429, interest = -0.131238
End of day 200: balance = 154.429, interest = -0.112199
End of day 201: balance = 122.429, interest = -0.0971046
End of day 202: balance = 106.929, interest = -0.0839215
End of day 203: balance = 42.9293, interest = -0.0786289
End of day 204: balance = -21.0707, interest = -0.0887313
End of day 205: balance = -92.0707, interest = -0.132875
End of day 206: balance = -126.571, interest = -0.193559
End of day 207: balance = -183.821, interest = -0.281693
End of day 208: balance = -215.571, interest = -0.385048
End of day 209: balance = 363.179, interest = -0.340273
End of day 210: balance = 318.929, interest = -0.300953
End of day 211: balance = 266.128, interest = 0.0328103
End of day 212: balance = 204.628, interest = 0.0580385
End of day 213: balance = 187.628, interest = 0.0811708
End of day 214: balance = 178.878, interest = 0.103224
End of day 215: balance = 122.378, interest = 0.118312
End of day 216: balance = 48.3784, interest = 0.124276
End of day 217: balance = -29.6216, interest = 0.110074
End of day 218: balance = -70.6216, interest = 0.0762146
End of day 219: balance = -144.372, interest = 0.00699534
End of day 220: balance = -187.622, interest = -0.0829602
End of day 221: balance = -235.372, interest = -0.19581
End of day 222: balance = -259.872, interest = -0.320406
End of day 223: balance = 321.628, interest = -0.280753
End of day 224: balance = 286.878, interest = -0.245384
End of day 225: balance = 244.378, interest = -0.215255
End of day 226: balance = 217.128, interest = -0.188486
End of day 227: balance = 164.128, interest = -0.168251
End of day 228: balance = 111.378, interest = -0.15452
End of day 229: balance = 74.1284, interest = -0.14538
End of day 230: balance = 16.3784, interest = -0.143361
End of day 231: balance = -29.3716, interest = -0.157444
End of day 232: balance = -78.3716, interest = -0.195019
End of day 233: balance = -156.872, interest = -0.270231
End of day 234: balance = -175.622, interest = -0.354434
End of day 235: balance = -207.372, interest = -0.453858
End of day 236: balance = -283.372, interest = -0.589721
End of day 237: balance = 244.878, interest = -0.559531
End of day 238: balance = 221.378, interest = -0.532238
End of day 239: balance = 214.128, interest = -0.505838
End of day 240: balance = 185.378, interest = -0.482983
End of day 241: balance = 159.645, interest = 0.0196823
End of day 242: balance = 131.145, interest = 0.0358509
End of day 243: balance = 89.1454, interest = 0.0468414
End of day 244: balance = 52.8954, interest = 0.0533628
End of day 245: balance = 10.6454, interest = 0.0546752
End of day 246: balance = -25.6046, interest = 0.042399
End of day 247: balance = -88.3546, interest = 3.72448e-05
End of day 248: balance = -139.105, interest = -0.0666568
End of day 249: balance = -213.855, interest = -0.16919
End of day 250: balance = -216.605, interest = -0.273041
End of day 251: balance = 341.145, interest = -0.230982
End of day 252: balance = 269.645, interest = -0.197738
End of day 253: balance = 154.895, interest = -0.178642
End of day 254: balance = 97.6454, interest = -0.166603
End of day 255: balance = -1.60462, interest = -0.167373
End of day 256: balance = -65.1046, interest = -0.198587
End of day 257: balance = -160.605, interest = -0.275589
End of day 258: balance = -204.105, interest = -0.373448
End of day 259: balance = -244.855, interest = -0.490844
End of day 260: balance = -269.605, interest = -0.620106
End of day 261: balance = -374.105, interest = -0.799471
End of day 262: balance = -444.105, interest = -1.0124
End of day 263: balance = -481.855, interest = -1.24342
End of day 264: balance = -568.605, interest = -1.51604
End of day 265: balance = -4.85462, interest = -1.51837
End of day 266: balance = -102.605, interest = -1.56756
End of day 267: balance = -112.105, interest = -1.62131
End of day 268: balance = -180.855, interest = -1.70802
End of day 269: balance = -228.355, interest = -1.81751
End of day 270: balance = -284.105, interest = -1.95372
End of day 271: balance = -335.558, interest = -0.160884
End of day 272: balance = -369.058, interest = -0.33783
End of day 273: balance = -425.058, interest = -0.541625
End of day 274: balance = -470.558, interest = -0.767235
End of day 275: balance = -521.808, interest = -1.01742
End of day 276: balance = -541.058, interest = -1.27683
End of day 277: balance = -617.558, interest = -1.57292
End of day 278: balance = -635.558, interest = -1.87764
End of day 279: balance = -99.3083, interest = -1.92525
End of day 280: balance = -181.558, interest = -2.0123
Ending interest = -2.0123
Ending balance = -181.558
Average end-of-day balance = 177.145