0

i keep getting this expression result unused in this line of the code else(cents>=1 && cents<5); . Any thoughts?

do{
if(cents>=25){
     tcoins++;
    cents=cents-25;
}
else if(cents>=10 && cents<25){
    tcoins++;
    cents=cents-10;
}
else if(cents>=5 && cents<10){
    tcoins++;
    cents=cents-5;
}
 else(cents>=1 && cents<5);{
    tcoins++;
    cents=cents-1;
}
1

I'm a new coder too, on week 5 of this course currently. I'm not 100% sure but I think you should do else if rather than just else because if you don't type the word if the computer won't take the given condition into consideration.

You must log in to answer this question.

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