Skip to content

Instantly share code, notes, and snippets.

@tylersamples
Created August 31, 2013 02:39
Show Gist options
  • Save tylersamples/6395913 to your computer and use it in GitHub Desktop.
Save tylersamples/6395913 to your computer and use it in GitHub Desktop.
/*
g++ ns.cc -o ns && ./ns
*/
#include <iostream>
const float currentNS = 762677;
const float avgDailyGrowth = 0.005274;
int main()
{
float ns = currentNS;
std::cout << "Current NS: " << ns << std::endl;
for(int i = 0; i<30; i++) // i<30 because there are 30 days in Sept
{
ns+=(ns*avgDailyGrowth);
std::cout << "[Day " << i << "]: " << ns << std::endl;
}
std::cout << "Total growth of: " << ns-currentNS << std::endl;
return 0;
}
/*
Current NS: 762677
[Day 0]: 766699
[Day 1]: 770743
[Day 2]: 774808
[Day 3]: 778894
[Day 4]: 783002
[Day 5]: 787132
[Day 6]: 791283
[Day 7]: 795456
[Day 8]: 799651
[Day 9]: 803869
[Day 10]: 808108
[Day 11]: 812370
[Day 12]: 816655
[Day 13]: 820962
[Day 14]: 825292
[Day 15]: 829644
[Day 16]: 834020
[Day 17]: 838418
[Day 18]: 842840
[Day 19]: 847285
[Day 20]: 851754
[Day 21]: 856246
[Day 22]: 860762
[Day 23]: 865301
[Day 24]: 869865
[Day 25]: 874453
[Day 26]: 879065
[Day 27]: 883701
[Day 28]: 888361
[Day 29]: 893047
Total growth of: 130370
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment