1

When testing my greedy with check50, I keep getting this error:

\ expected an exit code of 0, not standard error of "greedy.c:9:5: warning: ignoring return ..."

Here's my code

#include <cs50.h>
#include <stdio.h>
#include <math.h>
int main(void)
{
    printf("How much change is owed?\n");
float change = GetFloat();
change = change * 100;
round(change);
(int) change;
while(change <= 0)
{
    printf("How much change is owed?\n");
}
int coin_cnt = 0;
while(change >= 25)
{
    change = change - 25;
    coin_cnt = coin_cnt + 1;
}
while(change >= 10)
{
    change = change - 10;
    coin_cnt = coin_cnt + 1;
}
while(change >= 5)
{
    change = change - 5;
    coin_cnt = coin_cnt + 1;    
}
while(change >= 1)
{
    change = change - 1;
    coin_cnt = coin_cnt + 1;
}
printf("%d\n", coin_cnt);
}

What could be the problem?

2

you should add a

return 0 ;

at the end of yours programme whenever you set return value for main() as -

int main()

return 0 ; simply implies successfull termination of yours programme

And this line of yours error syntax should help you to debug in future , pretainning to errors like this you just got -

" warning: ignoring return ..."

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .