Wednesday, January 07, 2015

C++ codes for counting saving according to the number of days

Say you need to save RM according to the number of day in a year.

Day 1 in Jan =RM1
Day 2 in Jan =RM2

Day 365 in Dec = RM365

which is quite impossible at the end of the year.. because it's freaking a lot.

Anyway a friend want to count that hence I wrote my simple C++ program;

using namespace std;
int main()
int sum;
for (int i=1;i<=365;i++)
cout<<"Sum is "<return 0;

That's all.

No comments: