#include <stdio.h>

int main()
{
   int user, gus,a, b, c, d, e;
   int gap = user - gus;
   int mny[4] = {};
   int coin[5] = {50, 40, 10, 5, 1};
   scanf("%d", &user);
   scanf("%d", &gus);
   
   for (int i = 0; i < 4; i++)
   {
      a = gap % coin[0];
      mny[0] = gap / coin[0];

      gap % coin[0] % coin[1];
      mny[1] = a / coin[1];

      c = b % coin[2];
      mny[2] = b / coin[2];

      d = c % coin[3];
      mny[3] = c / coin[3];

      e = d % coin[4];
      mny[4] = d / coin[4];
   }

   printf("\n%d", mny[0]);
   printf("\n%d", mny[1]);
   printf("\n%d", mny[2]);
   printf("\n%d", mny[3]);
   printf("\n%d", mny[4]);
}

   // for (int i = 0; i <= 4; i++)
   // {
   //    mny[i] = gap / coin[i];
   //    gap = gap % coin[i];
   // }

   // for (int i = 0; i <= 4; i++)
   // {
   //    printf("%d\n",mny[i]);
   // }

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: