so I used check50 on my code and it said 1.6, 23, and 4.2 had a wrong output. Can you please help me to see what I am doing wrong? Here is my code:
#include <cs50.h>
#include <stdio.h>
#include <math.h>
int main(void)
{
float dollars;
do
{
dollars = get_float("Enter change owed:");
} while (dollars < 0);
int cents = round(dollars * 100);
int coins = 0;
int denominations[] = {50, 25, 10, 5, 1};
int size = sizeof (denominations)/sizeof(int);
for (int i = 0; i < size; i++)
{
coins += cents / denominations[i];
cents %= denominations[i];
}
printf("%i\n", coins);
}