Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <cs50.h>
- #include <math.h>
- int main()
- {
- float c;
- int s = 0, z = 0, d = 0, e = 0, x = 0, f = 0, cc = 0;
- do
- {
- c = get_float("Change:");
- }
- while (c < 0);
- c = c * 100;
- cc = c / 1;
- s = c / 25; // 1
- z = cc % 25;
- d = z / 10 ; // 2
- e = z % 10;
- x = e / 5; // 3
- f = e % 5;
- printf("I have %i Coins\n", s + d + x + f);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment