I wrote this code and it's not working at all
I hope my explaining is good .
So what I need from the "for" loop is to continue to the last condition I had. and at the end print the counter number
{
//to do math
float quarters = 0.25;
float dimes = 0.10;
float nickels = 0.5;
float pennies = 0.1;
//the number I need to transfer to 0
float n = 0.65;
//the counting number
int count = 0;
for (;;)
{
if (n >= quarters ) // -0.25
{
n = n - quarters;
count += 1;
return n ;
}
else if (n >= dimes) // -0.10
{
n = n - dimes;
count += 1;
return n ;
}
else if (n >= nickels) // 0.5
{
n = n - nickels;
count += 1;
return n ;
}
else if (n >= pennies) // 0.1
{
n = n - pennies;
count += 1;
return n ;
}
else //return the counting number
{
printf("%i",count);
break;
}
}
}