#include #include #include #include #include #include #include int howManyGames(int p, int d, int m, int s) { // Return the number of games you can buy int cost=p,total=0,update=0; int count=-1; do { count++; if(cost==0){ total=total+p; } else { if((cost-d)>m){ cost=cost-d; total=total+cost; } else{ cost=m; total=total+cost; } } }while(total