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!
Beijing and image manipulation addict Salam, Image manipulation with command line is fun and time consuming too. Given my Digikam plugins unable to work, I start to figure out many wonderful features of other tool which offer almost the same quality. However I was stucked with ImageMagick,with many tutorial on the net: Here and Here for i in *jpg ;do convert -font helvetica -fill white -pointsize 18 -draw 'text 10,50 "ACM-ICPC Beijing 2005"' $i $i;done The pix above shows a heater to heat up guest room during ACM-ICPC competition. (outside building's temperature is almost 4 celcious).