Created
September 19, 2018 20:57
-
-
Save j-walk/28e33ade39a7e72e0088c7b35d6dc9ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void get_coins(int a) { | |
int quarters = a / 25; a %= 25; | |
int dimes = a / 10; a %= 10; | |
int nickles = a / 5; a %= 5; | |
int pennies = a; | |
printf( " quarters: %d\n dimes: %d\n nickles: %d\n pennies: %d\n" | |
, quarters, dimes, nickles, pennies); | |
} | |
void main() { | |
int a; | |
printf( "cents: " ); | |
scanf( "%d", &a ); | |
get_coins( a ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment