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;
- do
- {
- c = get_float ("Change:" );
- }
- while(c < 0);
- c = c * 100;
- s = c / 25; // 1
- z = s % 25;
- d = z / 10 ; // 2
- e = z % 10;
- x = e / 5; // 3
- f = e % 5; //4
- printf("I have %i coins",s+d+x+f);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment