Donut Or Cake Editorial

Problem Link:

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+(kB)+Z
(X-A) = (k
B) + Z
where K is maximum donuts bought
and Z is remaining money
which is basically Z= (X-A)%B

using namespace std;
int main()
    int x,a,b;