Skip to content

Instantly share code, notes, and snippets.

@KronicDeth
Last active August 29, 2015 14:03
Show Gist options
  • Save KronicDeth/c54b68a513b8574296d3 to your computer and use it in GitHub Desktop.
Save KronicDeth/c54b68a513b8574296d3 to your computer and use it in GitHub Desktop.
#include <iostream> // includes and statements section
using std::cin; // user input
using std::cout; // machine output
using std::endl; // for line breaks
int main () {
int coupons;
cout << "How many coupons did you win?" << endl;
cin >> coupons;
cout << "You entered " << coupons << " coupons." << endl;
int candyBars;
candyBars = (coupons / 10);
cout << "You can get " << candyBars << " candy bars!" << endl;
int remainder;
remainder = (coupons % 10);
int gumballs;
gumballs = (remainder / 3);
int remainderGum;
remainderGum = (remainder % 3);
cout << "You can get " << gumballs << " gumballs!" << endl;
cout << "You will have " << remainderGum << " coupons left!" << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment