Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
Problem set 1 cash help
Post Flair (click to view more posts with a particular flair)
Post Body

Every time I try to run it Spits out zero help me !

include <cs50.h>

include <stdio.h>

int get_cents(void); int calculate_quarters(int cents); int calculate_dimes(int cents); int calculate_nickels(int cents); int calculate_pennies(int cents);

int main(void) { int cents = get_cents();

int quarters = calculate_quarters(cents);
cents = cents - quarters * 25;


int dimes = calculate_dimes(cents);
cents = cents - dimes * 10;


int nickels = calculate_nickels(cents);
cents = cents - nickels * 5;


int pennies = calculate_pennies(cents);
cents = cents - pennies * 1;


int coins = quarters   dimes   nickels   pennies;


printf("%i\n", coins);

}

int get_cents(void) { int cents; do { cents = get_int("Enter money "); } while (cents > 0); return cents; } int calculate_quarters(int cents) { int quarters = 0;

while (cents >= 25)
{
    quarters = 1   quarters;
    cents = cents - 25;
}

return quarters;

} int calculate_dimes(int cents) { int dimes = 0;

while (cents >= 10)
{
    dimes = 1   dimes;
    cents = cents - 10;
}

return dimes;

}

int calculate_nickels(int cents) { int nickels = 0;

while (cents >= 5)
{
    nickels= 1   nickels;
    cents = cents - 5;
}

return nickels;

}

int calculate_pennies(int cents) { int pennies = 0;

while (cents >= 1)
{
    pennies = 1   pennies;
    cents = cents - 1;
}

return pennies;

}

Author
Account Strength
50%
Account Age
4 years
Verified Email
No
Verified Flair
No
Total Karma
153
Link Karma
87
Comment Karma
66
Profile updated: 1 day ago
Posts updated: 6 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
2 years ago