/* * Write program that takes an int * it returns the change * simple simple * * input: 0 * output: No change * * input: 45 * output: * 1 Quarter * 2 Dimes * * Do Dollar, Quarter, Dime, Nickel, Penny * Note that 1 dollar and 2 dollars matter */ #include using namespace std; int main() { /* Type your code here. */ int runningTotal; cin >> runningTotal; //Forgot none so haste if(runningTotal <=0){cout << "No change\n";} //dollars if (runningTotal >= 100){ if (runningTotal/100 == 1){ cout << runningTotal/100 << " dollar\n"; } else { cout << runningTotal/100 << " dollars\n"; } runningTotal %=100; } //quarters if (runningTotal >= 25){ if (runningTotal/25 == 1){ cout << runningTotal/25 << " quarter\n"; } else { cout << runningTotal/25 << " quarters\n"; } runningTotal %=25; } //dimes if (runningTotal >= 10){ if (runningTotal/10 == 1){ cout << runningTotal/10 << " dime\n"; } else { cout << runningTotal/10 << " dimes\n"; } runningTotal %=10; } //Nickels if (runningTotal >= 5){ cout << runningTotal/5 << " nickel\n"; runningTotal %=5; } //Pennies if(runningTotal == 1){ cout << runningTotal << " penny\n"; } else if (runningTotal >1) { cout << runningTotal << " pennies\n"; } return 0; }