Explanation:

Given X total money, A cost of the cake, B cost of Donut.

After Buying a cake we need to buy as many donuts as possible

and output the remaining amount

hence X=A+(k*B)+Z
(X-A) = (k*B) + Z

where K is maximum donuts bought

and Z is remaining money

which is basically Z= (X-A)%B

```
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x,a,b;
cin>>x>>a>>b;
cout<<(x-a)%b<<'\n';
}
```