re: Daily Challenge #69 - Going to the Cinema VIEW POST

FULL DISCUSSION
 

JavaScript

const movie = (card, ticket, perc) => {
    let n = 1;
    let frac = ticket * perc;
    let a = ticket * n;
    let b = card + frac;
    while(a < Math.ceil(b)) {
        n++;
        frac = frac * perc;
        b = b + frac;
        a = ticket * n;
    }
    return n;
}
code of conduct - report abuse