#include <stdio.h>
#include <cs50.h>
#include <math.h>
int main(void)
{
float f;
int y;
// User block
do{
printf("How much change do you need? ");
f = (100*get_float());
y = round(f);
}
while ( f < 0 );
// count greedy
int amount = y;
int coin[] = {25,10,5,1};
int num;
for(int i=0; i<coin[i];i++ )
{
if(coin[i]<amount) {
num = amount / coin[i];
printf("%i\n", num);
amount -=num*coin[i];
}
}
how to solve this problem using array ??