#include #include int howManyGames(int p,int d,int m,int s); int howManyGames(int p,int d,int m,int s) { int i,sum=0,count=-1; while(sum<=s) { if(p=m) { sum=sum+p; p=p-d; count++; } } return(count); } int main() { int m,p,d,s,answer; printf("enter p,d,m,s: "); scanf("%d%d%d%d",&p,&d,&m,&s); assert(p>=1&&p<=100); assert(m>=1&&m<=p); assert(d>=1&&d<=100); assert(s>=1&&s<=10000); answer=howManyGames(p,d,m,s); printf("%d",answer); return 0; }