I'm trying to do the CS50 cash problem and the answer keeps getting number 1 no matter which change I input. It won't accept negative numbers as asked by the problem, but I don't know why it doesn't work for positive numbers. I really can't see where's is my mistake and I'm trying to see it since yesterday, I'm even comparing with other codes I found online and I can't see nothing. Please help me learn.
Here's my code
#include <cs50.h>
#include <stdio.h>
#include <math.h>
int main (void)
{
int coins=0;
int quantity=0;
float change;
do
{
change = get_float("change owed = ");
}while (change < 0);
quantity = round (quantity * 100);
while (quantity >= 25)
{
quantity-= 25 ;
coins ++;
}
while (quantity >= 10)
{
quantity -= 10;
coins++;
}
while (quantity >=5)
{
quantity -= 5;
coins++;
}
while (quantity>=1)
quantity -= 1;
coins++;
printf("%i\n", coins);
}
quantity = round (quantity * 100);
is what you meant?