# pset1 cash.c guidance

I am stuck on pset1 cash problem. When I run my script I get a blank and it never completes the calculation. The best I've been able to display is 0 even though its the wrong answer.

I figure I tackle getting the pennies portion right before making cookie-cutter formulas for the rest of the coins in the right order. In essence this is my proof of concept script.

Any or all input and advice is greatly appreciate it.

Thanks!

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

int main (void)

{
float n;

//do-while loop to prompt user until you get a positive dollar amount.
do

{
n = get_float("Enter the change you will give me: ");
}

while (n < 0);

//once you obtain a positive float round by multiplying by 100.
float  x = round(n*100);
//convert your float to an integer
int c = x;

int pennies;
int r;

//while the amount of change is less than 5 cents
while ( c < 5)
;
{   //do modulo math to determine answer
pennies =c % 1
;
//subtract pennies from c to get the remainder
r = c - pennies;

//print how many pennies you are giving back.
printf("%i" , pennies);
}}
``````

Also what on earth does "While loop has an empty body" mean ? why do I have to put the semicolon on the next line to fix it ?

Thanks.

That single `;` after your while is an empty statement, and in the code you show it is the loop's body. So your loop keeps doing nothing, and repeat that. Remove that extra semicolon. Semicola are meant to end statements (or separate the parts of a for loop), and there should be none between an if/while/for's controls or conditions and the thing executed conditionally.
• Oh, right, there's a second `while` as part of a `do..while`. Meant the regular `while` loop. Jan 8 '18 at 8:56