Hi there! I'm trying to work out this problem where I have to calculate the minimum number of coins required to give a user change. I compiled my program with no errors. The thing is whenever I input a value, it keeps giving me the value of 4 and I don't know why. Can someone help me with this?
Code:#include <stdio.h> #include <cs50.h> int main(void) { float balAmt; do { printf("Amount? $"); balAmt = get_float() * 100; } while (balAmt < 0); int coinCounter = 0; while (balAmt > 0) { while (balAmt >= 25) balAmt = balAmt - 25; coinCounter++; while (balAmt >= 10) balAmt = balAmt - 10; coinCounter++; while (balAmt >= 5) balAmt = balAmt - 5; coinCounter++; while (balAmt >= 1) balAmt = balAmt - 1; coinCounter++; printf("%i/n", coinCounter); } return 0; }