• + 0 comments

    int chocolates = n / c; int exchange_wrappers = chocolates;

        do{
            int rem = exchange_wrappers % m;
            exchange_wrappers = exchange_wrappers / m;
            chocolates += exchange_wrappers;
            exchange_wrappers = exchange_wrappers + rem;
    
        }while(exchange_wrappers >= m);
    
        return chocolates;