[Solved] Cannot figure out why my code is not working [closed]


If numberOfMiles should be of type float you have to exchange the following line

scanf("%d", &numberOfMiles);

by

scanf("%f", &numberOfMiles);

or you can set the type to int.

If you want to avoid an endless loop, exchange

} while (numberOfMiles > 1);

by

} while (numberOfMiles < 1);

Btw. why not allow distances that are shorter than a mile?

e.g. by

} while (numberOfMiles < 0);

For more specific answers, you have to be more precise.

solved Cannot figure out why my code is not working [closed]