Halloween Sale

  • + 0 comments

    Go pgm

    func howManyGames(p int32, d int32, m int32, s int32) int32 { var result int32 = 0 var sum int32 =0;

    for  {
            sum = sum +p
            if sum<=s{
                    result++
                    if p-d >=m{
                            p = p-d
                    }else{
                            p=m
                    }    
            }else{
                    break
            }
    }
    return result
    

    }