Created
April 18, 2019 07:06
-
-
Save andraantariksa/96aa03e10772fe387c3157387569b40b 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 <iostream> | |
int main(int argc, const char *argv[]){ | |
unsigned int money, chocolate_t, chocolate, coupon; | |
std::cin >> money; | |
coupon = money; | |
chocolate = money; | |
while(coupon >= 7){ | |
chocolate_t = coupon / 7; | |
chocolate += chocolate_t; | |
coupon %= 7; | |
coupon += chocolate_t; | |
} | |
std::cout << "You can have " << chocolate << " chocolate and " << coupon << " coupon left with $" << money << '\n'; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment