Skip to main content

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;


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


That's all.


Comments

Popular posts from this blog

Gue dengan S2 gue. Sronok banget!

Vultr - another reliable alternative for SEA Virtual Private Server!

I have been using Vultr  as my recent VPS now, since it has just a nearby Data Center in Singapore (sadly, Malaysian VPS is always expensive.. so the best option is DC in Singapore - most of the time). It provides free trial credit for around USD5.. and +USD2 if you did a social media integration/sharing with Twitter. Try it now. Click Vultr