We're a place where coders share, stay up-to-date and grow their careers.

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; }

JavaScript