#include <iostream> using namespace std; int main() { int dollar, cent, amount, leftover; int quarter, dime, nickel, penny; cout << "Write please amount of dollar through space"; cin >> dollar >> cent; amount = 100 * dollar + cent; quarter = amount / 25; leftover = amount % 25; dime = leftover / 10; leftover = leftover % 10; nickel = leftover / 5; leftover = leftover % 5; penny = leftover; cout << "Quarter: " << quarter << endl; cout << "Dime: " << dime << endl; cout << "Nickel: " << nickel << endl; cout << "Penny: " << penny << endl; return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter