Could anybody tell me what my mistakes are ?
#include <stdio.h>
#include <math.h>
int main (void)
{
float dollar;
do
{
dollar=get_float("Enter your change :");
}
while (dollar>=0);
int cents= round (dollar*100);
int coins=0;
while (cents>=25)
{
cents= cents-25;
coins++;
}
while (cents>=10)
{
cents= cents-10;
coins++;
}
while (cents=cents-5)
{
cents= cents-5;
coins++;
}
while (cents>=1)
{
cents=cents-1;
coins++;
}
printf ("You will need at least %i coins", coins);
}
$ ./cash
Enter your change0.34
You will need at least 6 coins$
$ check50 cs50/problems/2020/x/cash
Connecting.......
Authenticating.....
GitHub username: AnastasiaToskaa
GitHub password:
Verifying...............
Preparing..............
Uploading................
Waiting for results.....................................................................
Results for cs50/problems/2020/x/cash generated by check50 v3.1.2
:) cash.c exists
:) cash.c compiles
:( input of 0.41 yields output of 4
Did not find "4\n" in "Enter your cha..."
:( input of 0.01 yields output of 1
Did not find "1\n" in "Enter your cha..."
:( input of 0.15 yields output of 2
Did not find "2\n" in "Enter your cha..."
:( input of 1.6 yields output of 7
Did not find "7\n" in "Enter your cha..."
:( input of 23 yields output of 92
Did not find "92\n" in "Enter your cha..."
:( input of 4.2 yields output of 18
timed out while waiting for program to exit
:) rejects a negative input like -1
:) rejects a non-numeric input of "foo"
:) rejects a non-numeric input of ""
To see the results in your browser go to
https://submit.cs50.io/check50/7e964137024d7b7d7c084ee2e266dada2ffb914c