# Pset1 Greedy, Can not get my logic correct

OK so I am stuck on greedy, I am trying to do small steps at a time and using my logic I thought I was right but seems I am incorrect about my formula. I start with the quarter section and only use printf to see if it outputs a correct response but it does not. I have no idea what i am doing wrong . here is my code. It works when you put in any amount before a decimal but any amount that would be after does not work.

``````  #include <cs50.h>
#include <stdio.h>
#include <math.h>

int main(void){

int quarter = 25;
//int dime = 10;
//int nickel = 5;
int result, converted,leftOver;

printf("Enter amount ");
int userInput = get_float();

converted = round(userInput * 100);
result = converted / quarter;
leftOver = converted % quarter;

printf("%i ", result);
printf("%i ", leftOver);

}
``````
• I'm a newbie, but let's see if I can help... For decimals (change owed) you would have to use a float. You can use "int" for the coin values and for the counter (coins returned). Jan 19 '17 at 20:55
• I had to use a while loop because that was the easiest way for me... "while change is less or equal to" and then the coin. Jan 19 '17 at 21:01