/******************************************************
        CP-I Warmup 1999-2000
        Problem #3
******************************************************/

/*
 * Question:
 * 
 * Write a program to find the minimum number of currency notes required 
 * to make up the given amount as input. 
 * (Assume that 500,100,50,20,10,5,2,1 currency notes are available).
 *
 * If the given input is 638  
 * Ouput:
 *      500*1=500
 *      100*1=100
 *      20*1=20
 *      10*1=10
 *      5*1=5
 *      2*1=2
 *      1*1=1
 */

#include <stdio.h>
#define NO_OF_NOTES     8
struct note{
        int value;
        int count;
};

main()
{
struct note notes[NO_OF_NOTES]={{500,0},{100,0},{50,0},{20,0},{10,0},{5,0},{2,0},{1,0}};
int amount,i;
printf("Give the amount: ");
scanf("%d",&amount);
for(i=0;i<NO_OF_NOTES;)
{
        if(amount>=notes[i].value)
        {
                notes[i].count++;
                amount-=notes[i].value;
                continue;
        }
        i++;
}
for(i=0;i<NO_OF_NOTES;i++)
        if(notes[i].count)
                printf("%d*%d=%d\n",notes[i].value,notes[i].count,\
                                notes[i].value*notes[i].count);
}