Eng-Mohamed-Essam

Untitled

Jul 30th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <cs50.h>
  3. #include <math.h>
  4. int main ()
  5. {   float c;
  6.     int s = 0, z = 0, d = 0, e = 0, x = 0, f = 0;
  7.     do
  8.     {
  9.     c = get_float ("Change:" );
  10.     }
  11.     while(c < 0);
  12.     c = c * 100;
  13.  
  14.     s = c / 25; // 1
  15.     z = s % 25;
  16.    
  17.     d = z / 10 ; // 2
  18.     e = z % 10;
  19.  
  20.     x = e / 5; // 3
  21.     f = e % 5; //4
  22.     printf("I have %i coins",s+d+x+f);
  23.  
  24.    
  25.    
  26.    
  27.     return 0;  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment