Recently I challenged my co-worker to write an algorithm to solve this problem:
Find the least number of coins required that can make any change from
Example Program:
#include
#define LEN 9 // array length
int main(){
int coins[LEN]={0,0,0,0,0,0,0,0,0}; // coin count
int cointypes[LEN]={1000,500,100,50,20,10,5,2,1}; // declare your coins and note here {ASC order}
int sum =0; //temp variable for sum
int inc=0; // for loop
int amount=0; // for total amount
printf("Enter Amount :");
scanf("%d",&amount);
while(sum