[ create a new paste ] login | about

Link: http://codepad.org/fXWBbKlh    [ raw code | output | fork ]

C, pasted on Jul 5:
#include <stdio.h>
int main(void)
{
    int day,
        c5 , c10, c50, c100, c500, c1000, c5000, c10000;

    for(day = 0,
        c5 = c10 = c50 = c100 = c500 = c1000 = c5000 = c10000 = 0;
        c5 + c10 + c50 + c100 + c500 + c1000 + c5000 + c10000 < 20;
        day++)
    {
        c5++;
        if (   c5==2) {   c5=0;    c10++;}
        if (  c10==5) {  c10=0;    c50++;}
        if (  c50==2) {  c50=0;   c100++;}
        if ( c100==5) { c100=0;   c500++;}
        if ( c500==2) { c500=0;  c1000++;}
        if (c1000==5) {c1000=0;  c5000++;}
        if (c5000==2) {c5000=0; c10000++;}
    }
    printf("%d\n",day);
    return 0;
}


Output:
1
9999


Create a new paste based on this one


Comments: