// Arup Guha
// 9/14/2011
// Written in COP 3223 for an introduction to loops.
#include <stdio.h>

const double EPSILON = 0.00000001;

int main() {

    int i;

    // Since Danny came to class and made everyone sing...
    /*** i++ is short for i = i + 1 ***/
    for (i=1; i<=100; i++)
        printf("I won't interrupt class to sing to you.\n");

    for (i=1; i<=100; i++)
        printf("%d. I won't interrupt class to sing to you.\n", i);

    // Count down!
    for (i=10; i>=2; i--)
        printf("%d, ", i);
    printf("%d\n", i);
    printf("Happy New Year!!!\n");

    // Get paid more every day, in an arithmetic series.
    double money = 0;
    double daypay;
    for (daypay=100; daypay<=3000+EPSILON; daypay += 100)
        money = money + daypay;
    printf("At the end of the month you will have $%.2lf\n", money);

    // Get paid in a geometric series. This turns out to be better.
    money = 0;
    daypay = 0.01;
    int day;
    for (day=1; day <= 30; day++) {
        money = money + daypay;
        daypay = 2*daypay;
    }
    printf("At the end of the month you will have $%.2lf\n", money);

    return 0;
}
