I am writing a program in c . The idea is to give a money value ;i.e. 2,75 and the program must give an output which will be the minimum number of coins (quarters,dimes,nickels,pennies) needed to reach the above value.
My code is the following:
Code:#include <stdio.h> #include <math.h>Can anyone help me to complete the code and make it run properly, because I'm confused?Code:int main(void) { printf("Give an amount: "); int n; int d; } do { printf("non-negative numerator:"); n = GetInt(); } while (n < 1); do { printf("positive denominator: "); d = GetInt(); } { while (d < 1); float a = (n / d); printf("%.2f \n", a); } int (cent , nickle , dime ,penny ,sum); do { cent = round(n * 100); while (cent >= quarter); cent = (cent - quarter); count++; while (cent >= dime); cent = (cent - dime); count++; while (cent >= nickle); cent = (cent - nickle); count++; while (cent - penny); cent = (cent - penny); count++; printf("%d",count); // ?????????????????? return 0; }



LinkBack URL
About LinkBacks



